Fina Silva-Santisteban
10/25/2023, 5:24 PMsnowflake_multiquery
(https://prefecthq.github.io/prefect-snowflake/database/#prefect_snowflake.database.snowflake_multiquery) to return the column names along with the query result? (The result type is List[List[Tuple[Any]]]
but it doesn't contain a line for the column names)Fina Silva-Santisteban
10/25/2023, 5:32 PMFina Silva-Santisteban
10/25/2023, 6:43 PMpandas
extra to load everything into dataframes instead and that works out fine. If anyone's curious: I'm using my existing snowflake blocks to set up the connection:
ctx = snowflake.connector.connect(
user=snowflake_connector.credentials.user,
password=snowflake_connector.credentials.password.get_secret_value(),
account=snowflake_connector.credentials.account,
warehouse=snowflake_connector.warehouse,
database=snowflake_connector.database,
schema=snowflake_connector.schema)
# Create a cursor object.
cur = ctx.cursor()
# Execute a statement that will generate a result set.
sql = SQL_QUERY_HERE
cur.execute(sql)
# Fetch the result set from the cursor and deliver it as the Pandas DataFrame.
df = cur.fetch_pandas_all()
print(df)