Using SQL queries in a python worksheet in Snowflake

Did you know you can use SQL queries in your Python worksheets in Snowflake? This works as follows:

dataframe = session.sql( ”’ YOUR SQL QUERY GOES HERE ”’ )

And voila! Don’t forget to return it in the function in the worksheet if you wish to inspect the resulting dataframe in the results pane.

I have used this recently in a stored procedure. The goal of the stored procedure was to check if certain categories from Table_A existed in Table_B and if not, send an email detailing the categories that had to be added to Table_B. Very useful stuff.

Leave Comment

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *