SQLAlchemy dialect for Polnor — connect ORM, Alembic, pandas, FastAPI, Superset to the Polnor lakehouse.
Project description
polnor-sqlalchemy
SQLAlchemy dialect for Polnor — connect every SQLAlchemy-aware tool (pandas, FastAPI, Alembic, Superset, Metabase, ORM apps) to a Polnor SQL warehouse over a single URL.
Install
pip install polnor-sqlalchemy
This installs polnor (the core SDK) and sqlalchemy>=2.0 as
dependencies.
Quick start
from sqlalchemy import create_engine, text
engine = create_engine(
"polnor://api.polnor.net/?token=<your-pat>&warehouse_id=<wh-id>"
)
with engine.connect() as conn:
result = conn.execute(text("SELECT region, COUNT(*) c FROM demo.orders GROUP BY region"))
for row in result:
print(row)
URL format
polnor://<host>[:<port>]/?token=<...>&warehouse_id=<...>[&workspace_slug=<...>]
host— hostname of the Polnor API, e.g.api.polnor.nettoken— personal access token (also accepted as the URL password)warehouse_id— id of the SQL warehouse to run queries againstworkspace_slug(optional) — pin to a specific workspace when the token spans multiple
Inside a Polnor notebook or job, you can use the bare form
polnor:// — the SDK auto-resolves credentials from env vars
injected by the runtime.
Pandas
import pandas as pd
df = pd.read_sql("SELECT * FROM demo.orders LIMIT 100", engine)
No more "Other DBAPI2 objects are not tested" warning — the dialect is the supported integration point for pandas.
Reflection
from sqlalchemy import MetaData, Table
md = MetaData()
orders = Table("orders", md, autoload_with=engine, schema="demo")
print([c.name for c in orders.columns])
Reflection uses Polnor's catalog API (polnor.tables) to introspect
namespaces, table columns, and types. Iceberg has no FK/PK/index
metadata — these are returned empty.
DDL — CREATE TABLE ... USING iceberg
from sqlalchemy import Column, Integer, String, Table, MetaData
md = MetaData()
users = Table(
"users", md,
Column("id", Integer, nullable=False),
Column("email", String),
schema="demo",
)
md.create_all(engine) # emits: CREATE TABLE demo.users (...) USING iceberg
The dialect appends USING iceberg so Polnor routes the DDL to the
Spark sidecar that can actually write Iceberg.
Compatibility
- Python ≥ 3.9
- SQLAlchemy ≥ 2.0
- Polnor SDK ≥ 1.0
Limitations (V1)
- Auto-commit only — no transactional rollback (Polnor warehouses run one statement per transaction at the engine level).
- No native FK/PK/index reflection (Iceberg doesn't have these).
- Async (
asyncio+create_async_engine) not supported yet.
Links
- Polnor: https://polnor.net
- Core SDK: https://pypi.org/project/polnor/
- Source / issues: https://github.com/polnor/polnor
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file polnor_sqlalchemy-0.1.0.tar.gz.
File metadata
- Download URL: polnor_sqlalchemy-0.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da9893b490ce38b6024d114e67523f01aa15a98e8bfbbc36be1546edd928fcfb
|
|
| MD5 |
62575fc21391662c584c941359658d89
|
|
| BLAKE2b-256 |
1e77cf923894fb0539a633e16a8cc6af6f1ec7408582e4f248fdfdc6bad0e51d
|
File details
Details for the file polnor_sqlalchemy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: polnor_sqlalchemy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6addfef876c2efb12bb632728616c8d613dee5d5be27ce2c5635489f21cb5df7
|
|
| MD5 |
02a9e23051f9788de007630dfc0d0796
|
|
| BLAKE2b-256 |
603fd37141e319fd7661979238dbaeb10dc325e87fb129a71867915b569b4b48
|