Your PySpark code. Your database.
Run the PySpark DataFrame API directly on your database.
No Spark cluster required.
Why SQLFrame?
- Familiar API. Write transformations with PySpark DataFrame operations, joins, and window functions.
- Direct execution. Run your transformations on your database engine.
- Visible SQL. Inspect, debug, and share the queries behind your DataFrame code.
Try it locally
Install SQLFrame with DuckDB. You need Python 3.10 or later; no cloud account or Spark installation is required.
pip install "sqlframe[duckdb]"
from sqlframe.duckdb import DuckDBSession
session = DuckDBSession()
df = session.createDataFrame(
[("US", 120), ("UK", 80), ("US", 30)],
["country", "revenue"],
)
df.groupBy("country").sum("revenue").orderBy("country").show()
+---------+--------------+
| country | sum(revenue) |
+---------+--------------+
| UK | 80 |
| US | 150 |
+---------+--------------+
To inspect a transformation's SQL, call df.sql(optimize=True). Follow the quickstart for a complete walkthrough.
Choose your engine
| Engine | Install |
|---|---|
| DuckDB | pip install "sqlframe[duckdb]" |
| BigQuery | pip install "sqlframe[bigquery]" |
| Snowflake | pip install "sqlframe[snowflake]" |
| Postgres | pip install "sqlframe[postgres]" |
| ClickHouse (preview) | pip install "sqlframe[clickhouse]" |
| Databricks | pip install "sqlframe[databricks]" |
| Spark | pip install "sqlframe[spark]" |
| Standalone | pip install sqlframe |
| Trino (preview) | pip install "sqlframe[trino]" |
Standalone sessions generate SQL without a database connection. For local Parquet support, install sqlframe[standalone].
ClickHouse and Trino are preview integrations; see their guides for supported workflows and limits.
Community integrations: GizmoSQL · Redshift (pip install "sqlframe[redshift]").
SQLFrame is also available on conda-forge: conda install -c conda-forge sqlframe.
Already using PySpark?
Activate SQLFrame before importing PySpark to run supported transformations on another engine.
from sqlframe import activate
activate("duckdb")
from pyspark.sql import SparkSession
session = SparkSession.builder.getOrCreate()
You can also import SQLFrame directly, as shown in the quickstart. See the activation guide and your engine's API compatibility reference for details.
Keep exploring
- Examples: longer pipelines with aggregations and window functions.
- Generated SQL: formatting, optimization, dialect overrides, and OpenAI enrichment.
- Input and output dialects: configure SQLFrame for your engine's conventions.
- Standalone SQL generation: generate queries without connecting to an engine.
SQLFrame is open source under the MIT license.
Metadata
Release files for sqlframe 4.9.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sqlframe-4.9.0.tar.gz | 17.7 MB | With provenance | Details for sqlframe-4.9.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlframe-4.9.0-py3-none-any.whl | Python 3 | none | any | Details for sqlframe-4.9.0-py3-none-any.whl |
Total release size: 17.9 MB
Release files / sqlframe-4.9.0.tar.gz
| Download URL | sqlframe-4.9.0.tar.gz |
|---|---|
| Size | 17.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0436e717fdbbc7db762367d676fc2421a816a9e7005aca78b40339d83050ab8
|
|
BLAKE2b-256 checksum How to use checksums |
de944bb0d77cecf435df72d2a6d9b32f3dee606edd1983d11a550bfcbf49b2fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logRelease files / sqlframe-4.9.0-py3-none-any.whl
| Download URL | sqlframe-4.9.0-py3-none-any.whl |
|---|---|
| Size | 253.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08d1392178bbeec267d92f551d2da7fe8577858bd41ffb4412d32d0a001b20a4
|
|
BLAKE2b-256 checksum How to use checksums |
90bf77b06bb01d8fb386cc8c7a92dcc4ec15f36f069b042eef0a1398a8459c14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logSecurity for sqlframe 4.9.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sqlframe-4.9.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 27, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.