awswrangler.timestream.query

awswrangler.timestream.query(sql: str, chunked: bool = False, pagination_config: Optional[Dict[str, Any]] = None, boto3_session: Optional[Session] = None) Union[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], 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.

Returns

Pandas DataFrame https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html

Return type

Union[pd.DataFrame, Iterator[pd.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')