awswrangler.timestream.query

awswrangler.timestream.query(sql: str, chunked: bool = False, pagination_config: dict[str, Any] | None = None, boto3_session: Session | None = None) DataFrame | Iterator[DataFrame]

Run a query and retrieve the result as a Pandas DataFrame.

Parameters:
  • sql (str) – SQL query.

  • chunked (bool) – If True returns DataFrame iterator, and a single DataFrame otherwise. False by default.

  • pagination_config (dict[str, Any] | None) – Pagination configuration dictionary of a form {‘MaxItems’: 10, ‘PageSize’: 10, ‘StartingToken’: ‘…’}

  • boto3_session (Session | None) – The default boto3 session will be used if boto3_session is None.

Return type:

DataFrame | Iterator[DataFrame]

Returns:

Pandas DataFrame

Examples

Run a query and return the result as a Pandas DataFrame or an iterable.

>>> import awswrangler as wr
>>> df = wr.timestream.query('SELECT * FROM "sampleDB"."sampleTable" ORDER BY time DESC LIMIT 10')