Skip to main content

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.net
  • token — personal access token (also accepted as the URL password)
  • warehouse_id — id of the SQL warehouse to run queries against
  • workspace_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

License

Apache-2.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polnor_sqlalchemy-0.1.0.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polnor_sqlalchemy-0.1.0-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

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

Hashes for polnor_sqlalchemy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da9893b490ce38b6024d114e67523f01aa15a98e8bfbbc36be1546edd928fcfb
MD5 62575fc21391662c584c941359658d89
BLAKE2b-256 1e77cf923894fb0539a633e16a8cc6af6f1ec7408582e4f248fdfdc6bad0e51d

See more details on using hashes here.

File details

Details for the file polnor_sqlalchemy-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for polnor_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6addfef876c2efb12bb632728616c8d613dee5d5be27ce2c5635489f21cb5df7
MD5 02a9e23051f9788de007630dfc0d0796
BLAKE2b-256 603fd37141e319fd7661979238dbaeb10dc325e87fb129a71867915b569b4b48

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page