Skip to content

PrepareQuery

Source: src/AWS/Timestream/PrepareQuery.ts

Runtime binding for timestream-query:PrepareQuery — validate a SQL query against a Timestream Table and inspect its result schema and parameter mappings without running it.

Bind the operation to the table the SQL reads so the host is granted timestream:PrepareQuery and timestream:Select on it (plus the unscoped timestream:DescribeEndpoints the endpoint-discovery flow needs). The query string itself still references the database and table by name.

Provide Timestream.PrepareQueryHttp on the Function to implement the binding.

// init — bind the operation to the table the SQL reads
const prepareQuery = yield* Timestream.PrepareQuery(table);
// runtime — validate only; Columns/Parameters describe the result shape
const prepared = yield* prepareQuery({
QueryString: `SELECT COUNT(*) AS c FROM "${databaseName}"."${tableName}"`,
ValidateOnly: true,
});
// prepared.Columns[0].Name === "c"