Metadata-Version: 2.5
Name: snowflake-connector-python
Version: 5.0.0rc1
Summary: Snowflake DB driver for Python
Project-URL: Homepage, https://github.com/snowflakedb/drivers
Project-URL: Bug Reports, https://github.com/snowflakedb/drivers/issues
Project-URL: Source, https://github.com/snowflakedb/drivers
Project-URL: Documentation, https://github.com/snowflakedb/drivers/blob/main/README.md
License: Apache-2.0
Keywords: api,database,dbapi,pep249,python,snowflake
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: cryptography>=46.0.5
Requires-Dist: protobuf>=6.32.1
Requires-Dist: pytz
Requires-Dist: tomlkit>=0.13
Provides-Extra: dev
Requires-Dist: hatchling; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: mypy-protobuf; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: types-protobuf; extra == 'dev'
Requires-Dist: types-pytz; extra == 'dev'
Provides-Extra: pandas
Requires-Dist: pandas<3.0.0,>=1.0.0; (python_version < '3.13') and extra == 'pandas'
Requires-Dist: pandas>=2.1.2; (python_version >= '3.13') and extra == 'pandas'
Requires-Dist: pyarrow>=14.0.1; extra == 'pandas'
Provides-Extra: pyarrow
Requires-Dist: pyarrow>=14.0.1; extra == 'pyarrow'
Provides-Extra: test
Requires-Dist: brotli; extra == 'test'
Requires-Dist: hypothesis; extra == 'test'
Requires-Dist: numpy>=1.23.0; (python_version < '3.12') and extra == 'test'
Requires-Dist: numpy>=1.26.0; (python_version >= '3.12' and python_version < '3.13') and extra == 'test'
Requires-Dist: numpy>=2.1.0; (python_version >= '3.13') and extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Requires-Dist: pytest-json-report; extra == 'test'
Requires-Dist: pytest-randomly; extra == 'test'
Requires-Dist: pytest-split; extra == 'test'
Requires-Dist: pytest-timeout; extra == 'test'
Requires-Dist: pytest-xdist; extra == 'test'
Requires-Dist: pytest>=8; extra == 'test'
Requires-Dist: requests; extra == 'test'
Requires-Dist: tomlkit; extra == 'test'
Requires-Dist: tzdata; extra == 'test'
Requires-Dist: zstandard; extra == 'test'
Description-Content-Type: text/markdown

# Snowflake Connector for Python

> [!CAUTION]
> This version of the driver is in public preview and is not ready for use with production data and may be unstable.

This package includes the Snowflake Connector for Python, which conforms to the [Python DB API 2.0](https://www.python.org/dev/peps/pep-0249/) specification.

The Snowflake Connector for Python provides an interface for developing Python
applications that can connect to Snowflake and perform all standard operations. It
provides a programming alternative to developing applications in Java or C/C++
using the Snowflake JDBC or ODBC drivers.

The connector has **no** dependencies on JDBC or ODBC.
It can be installed using ``pip`` on Linux, Mac OSX, and Windows platforms
where Python 3.10.0 (or higher) is installed.


## Development

### Prerequisites
- Python 3.10+
- [uv](https://docs.astral.sh/uv/) package manager
- [Hatch](https://hatch.pypa.io/) build tool
- Rust toolchain (for building core library)
- Credentials: `../parameters.json` (see main [README.md](../README.md) for setup instructions)

### Setup

Install uv and Hatch:
```bash
# Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install Hatch
uv tool install hatch
```

**Note:** The Rust core library is built automatically during the build process via a custom Hatch build hook. You don't need to build it manually.

### Environment Variables

**IMPORTANT:** Set up required environment variables before running tests:

```bash
export PARAMETER_PATH="$(pwd)/../parameters.json"
```

## Hatch Environments

This project uses [Hatch](https://hatch.pypa.io/) to manage development environments. There are two primary environments for running tests, each designed for a different use case:

### `dev` Environment (for local development)

The `dev` environment is designed for **human developers** during active development. It installs the package from sources in **editable mode**, meaning any code changes are immediately reflected without reinstallation.

**Key characteristics:**
- Installs from sources (`skip-install = false`)
- Editable mode enabled (`dev-mode = true`)
- Changes to source code are immediately available
- Supports Python matrix: 3.10, 3.11, 3.12, 3.13, 3.14

**Usage:**
```bash
# Run all tests with the dev environment
hatch run dev:all

# Run specific test types
hatch run dev:unit              # Unit tests only
hatch run dev:integ             # Integration tests only
hatch run dev:e2e               # End-to-end tests only

# Run with coverage
hatch run dev:all-cov

# Run with specific Python version
hatch run dev.py3.12:all

# Pass additional pytest arguments
hatch run dev:all -k test_connection --maxfail=1
```

### `test` Environment (for CI/CD pipelines)

The `test` environment is designed for **CI systems** to test the end-to-end software development lifecycle (SDLC). It does **not** install from sources - instead, it expects a pre-built wheel to be installed, simulating how end users would install and use the package.

**Key characteristics:**
- Skips source installation (`skip-install = true`)
- No editable mode (`dev-mode = false`)
- Requires explicit wheel installation via `install-wheel` script
- Tests the actual built artifact, not source code

**Usage:**
```bash
# First, build the wheel
hatch build

# Then install and test with the test environment
hatch run test:install-wheel
hatch run test:all

# Or with specific Python version
hatch run test.py3.12:install-wheel
hatch run test.py3.12:all
```

### Environment Comparison

| Aspect | `dev` | `test` |
|--------|-------|--------|
| **Purpose** | Local development | CI/CD pipelines |
| **Installs from** | Source (editable) | Pre-built wheel |
| **Code changes** | Immediately reflected | Requires rebuild |
| **Tests** | Source code | Built artifact |
| **Use case** | Developer workflow | E2E SDLC validation |

### Other Environments

```bash
# Code quality checks
hatch run precommit:check        # Run all checks (format, lint, type)
hatch run precommit:fix          # Auto-fix formatting and linting issues

# Reference connector tests (for compatibility testing, installs latest v4.x)
hatch run reference:test
# Pin a specific version if needed:
PYTHON_REFERENCE_DRIVER_VERSION='==4.3.0' hatch run reference:test
```

## References

- [PEP 249 - Python Database API Specification v2.0](https://peps.python.org/pep-0249/)
- [Python Database API Specification v2.0](https://www.python.org/dev/peps/pep-0249/) 