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

snowflake.snowpark.Session.query_history

Session.query_history() QueryHistory[source]

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