awswrangler.dynamodb.read_partiql_query

awswrangler.dynamodb.read_partiql_query(query: str, parameters: List[Any] | None = None, chunked: bool = False, boto3_session: Session | None = None) DataFrame | Iterator[DataFrame]

Read data from a DynamoDB table via a PartiQL query.

Parameters:
  • query (str) – The PartiQL statement.

  • parameters (Optional[List[Any]]) – The list of PartiQL parameters. These are applied to the statement in the order they are listed.

  • chunked (bool) – If True an iterable of DataFrames is returned. False by default.

  • boto3_session (Optional[boto3.Session]) – Boto3 Session. If None, the default boto3 Session is used.

Returns:

Result as Pandas DataFrame.

Return type:

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

Examples

Select all contents from a table

>>> import awswrangler as wr
>>> wr.dynamodb.read_partiql_query(
...     query="SELECT * FROM my_table WHERE title=? AND year=?",
...     parameters=[title, year],
... )

Select specific columns from a table

>>> wr.dynamodb.read_partiql_query(
...     query="SELECT id FROM table"
... )