You are viewing documentation about an older version (1.16.0). View latest version

snowflake.snowpark.Session.query_history

Session.query_history() QueryHistory[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.16.0/src/snowflake/snowpark/session.py#L3083-L3094)

Create an instance of QueryHistory as a context manager to record queries that are pushed down to the Snowflake database.

>>> with session.query_history() as query_history:
...     df = session.create_dataframe([[1, 2], [3, 4]], schema=["a", "b"])
...     df = df.filter(df.a == 1)
...     res = df.collect()
>>> assert len(query_history.queries) == 1
Copy
Language: English