Skip to content

Query

Source: src/AWS/Timestream/Query.ts

Runtime binding for timestream-query:Query — run SQL queries against a Timestream Table.

Bind the operation to a table inside a function runtime to get a callable that grants timestream:Select on the table (plus the unscoped timestream:DescribeEndpoints the endpoint-discovery flow needs). The query string itself still references the database and table by name.

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

// init — bind the operation to the table
const query = yield* Timestream.Query(table);
// runtime — run a SQL query
const result = yield* query({
QueryString: `SELECT COUNT(*) AS c FROM "${databaseName}"."${tableName}"`,
});
// result.Rows / result.ColumnInfo hold the result set