Sign inGet started
← Back to all guides

Connecting to Snowflake from a Jupyter notebook

By Nick Barth

Updated on March 6, 2024

Connecting to Snowflake from a Jupyter notebook involves the use of Snowflake's Python connector.

Below is a general step-by-step guide:

  1. Install the Snowflake connector. In your Jupyter notebook, install the connector using the following command:
!pip install snowflake-connector-python

2. Import the connector. At the beginning of your script, import the connector with the import statement:

import snowflake.connector

3. Establish a connection. Create a connection object with your Snowflake account credentials:

conn = snowflake.connector.connect(
⁠    user='<your_username>',
⁠    password='<your_password>',
⁠    account='<your_account_url>',
⁠    warehouse='<your_warehouse>',
⁠    database='<your_database>',
⁠    schema='<your_schema>'

4. Execute queries. With the connection established, you can execute reads and writes to your Snowflake instance:

cursor = conn.cursor()
⁠    cursor.execute('<YOUR_SQL_QUERY>')
⁠    for row in cursor:
⁠        print(row)
⁠    cursor.close()

5. Close the connection. It's important to close the connection once your operations are complete:


Always ensure that your credentials are stored securely and not exposed in the Jupyter notebook to prevent unauthorized access to your Snowflake account.

That’s it, time to try Deepnote

Get started – it’s free
Book a demo



  • Integrations
  • Pricing
  • Documentation
  • Changelog
  • Security




  • Privacy
  • Terms

© Deepnote