0% found this document useful (0 votes)
76 views

Creating A Session For Snowpark Python - Snowflake Documentation

The document discusses how to create a session in Snowpark Python to connect to a Snowflake database by importing the Session class and using connection parameters like account, user, and password in a dictionary to authenticate and construct a session object.

Uploaded by

demorepo99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views

Creating A Session For Snowpark Python - Snowflake Documentation

The document discusses how to create a session in Snowpark Python to connect to a Snowflake database by importing the Session class and using connection parameters like account, user, and password in a dictionary to authenticate and construct a session object.

Uploaded by

demorepo99
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

4/29/24, 3:05 PM Creating a Session for Snowpark Python | Snowflake Documentation

Developer Snowpark API Python Creating a Session


Creating a Session for Snowpark Python
To use Snowpark in your application, you need to create a session. For convenience
in writing code, you can also import the names of packages and objects.
Creating a Session
The first step in using the library is establishing a session with the Snowflake
database.
Import the Session class.
>>> from snowflake.snowpark import Session

To authenticate, you use the same mechanisms that the Snowflake Connector for
Python supports.
Establish a session with a Snowflake database using the same parameters (for
example, the account name, user name, etc.) that you use in the connect function
in the Snowflake Connector for Python. For more information, see the parameters
for the connect function in the Python Connector API documentation.
Construct a dictionary ( dict ) containing the names and values of these
parameters (e.g. account , user , role , warehouse , database , schema , etc.).
To create the session:
1. Create a Python dictionary ( dict ) containing the names and values of the
parameters for connecting to Snowflake.
2. Pass this dictionary to the Session.builder.configs method to return a
builder object that has these connection parameters.
3. Call the create method of the builder to establish the session.
The following example uses a dict containing connection parameters to create a
new session:
>>> connection_parameters = {
... "account": "<your snowflake account>",
... "user": "<your snowflake user>",
... "password": "<your snowflake password>",
https://docs.snowflake.com/en/developer-guide/snowpark/python/creating-session 1/1

You might also like