Metadata-Version: 2.1
Name: devart-snowflake-connector
Version: 1.4.0
Summary: New level of functionality and performance in data access via Python
Home-page: https://devart.com
Author: Devart
Author-email: support@devart.com
License: Other/Proprietary License
Project-URL: Homepage, http://devart.com/python/snowflake
Project-URL: Download, http://devart.com/python/snowflake/download.html
Project-URL: History, http://devart.com/python/snowflake/revision_history.html
Project-URL: License, https://www.devart.com/python/eula.html
Project-URL: Documentation, http://docs.devart.com/python/snowflake/overview.htm
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE

# Python Connector for Snowflake #

Python Connector for Snowflake is a connectivity solution for accessing
the Snowflake data cloud from Python applications. It fully implements
the Python DB API 2.0 specification. The connector is distributed as a wheel
package for Windows and Windows Server.

## Connecting ##

To establish a connection to Snowflake, import the connector and authenticate
using basic, OAuth 2.0, or key pair authentication.

Import the Snowflake connector module.
```
import devart.snowflake as snowflake
```
Connect to your Snowflake environment using the `connect()` module method and obtain a `connection` object.
You can connect to Snowflake using either basic authentication, OAuth 2.0 authentication, or key pair authentication.
#### Basic authentication ####
For basic authentication, provide the Snowflake server URL, user name, and password.
```
my_connection = snowflake.connect(
    Domain="&lt;your_server_url&gt;",
    UserId="&lt;your_username&gt;",
    Password="&lt;your_password&gt;",
    Database="&lt;your_database&gt;"
)
```

#### OAuth 2.0 authentication ####
For OAuth 2.0 authentication, provide the Snowflake server URL and your OAuth client ID and client secret.
```
response = snowflake.signin(
    Domain="&lt;your_server_url&gt;",
    ClientId="&lt;your_client_id&gt;",
    ClientSecret="&lt;your_client_secret&gt;"
)
my_connection = snowflake.connect(
    Domain="&lt;your_server_url&gt;",
    Authentication="OAuth",
    ClientId="&lt;your_client_id&gt;",
    ClientSecret="&lt;your_client_secret&gt;",
    RefreshToken=response["Refresh Token"],
    Database="&lt;your_database&gt;"
)
```

#### Key pair authentication ####
For key pair authentication, provide the Snowflake server URL, user name, and private key (with its passphrase, if the key is encrypted).
```
my_connection = snowflake.connect(
    Authentication="KeyPair",
    Domain="&lt;your_server_url&gt;",
    UserId="&lt;your_username&gt;",
    Database="&lt;your_database&gt;",
    Passphrase="&lt;your_passphrase&gt;",
    PrivateKey="&lt;your_private_key&gt;"
)
```

## Querying data ##

Once connected, you can execute SQL queries to retrieve data from
your Snowflake database.

### Execute a query ###

Create a `cursor` object using the `cursor()` connection method.
```
my_cursor = my_connection.cursor()
```
Execute a SQL query using the `execute()` cursor method.
```
my_cursor.execute("SELECT * FROM employees")
```
Retrieve results using one of the `fetch*()` methods.
```
for row in my_cursor.fetchall(): 
    print(row)
```

### Parameterized queries ###

You can use parameterized queries to pass variable values to your SQL statements. This allows you to reuse the same query with different data and helps to prevent SQL injection attacks.

Pass parameters as a list or tuple to the `execute()` method:

```
for row in my_cursor.fetchall(): 
    print(row)
```

Each placeholder `?` in the query is replaced with a corresponding value from the parameter list.

## Ordering and activating the license ##

You can purchase a license for the connector on the ordering page:             
https://www.devart.com/python/snowflake/ordering.html

To activate the license, follow the instructions in the documentation:             
https://docs.devart.com/python/snowflake/activate-a-license.htm

## What's new ##

Python Connector for Snowflake 1.4

- Added support for Python 3.15
- Added support for the OAuth authentication
- Added support for the key-pair authentication
