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.

  • sql (str) – SQL query.

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

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

  • boto3_session (boto3.Session(), optional) – Boto3 Session. The default boto3 Session will be used if boto3_session receive None.


Pandas DataFrame

Return type:

Union[pd.DataFrame, Iterator[pd.DataFrame]]


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')