Sqlalchemy adapter for Firebolt
Project description
firebolt-sqlalchemy
The Firebolt dialect for SQLAlchemy. firebolt-sqlalchemy
uses Firebolt's Python SDK which implements PEP 249.
Installation
Requires Python >=3.7.
pip install firebolt-sqlalchemy
Connecting
Connection strings use the following structure:
firebolt://{username}:{password}@{database}[/{engine_name}]
engine_name
is optional. If omitted, Firebolt will use the default engine for the database.
Examples:
firebolt://email@domain:password@sample_database
firebolt://email@domain:password@sample_database/sample_engine
To override the API URL (e.g. for dev testing):
export FIREBOLT_BASE_URL=<your_url>
Quick Start
from sqlalchemy import create_engine
engine = create_engine("firebolt://email@domain:password@sample_database/sample_engine")
connection = engine.connect()
connection.execute("CREATE FACT TABLE example(dummy int) PRIMARY INDEX dummy")
connection.execute("INSERT INTO example(dummy) VALUES (11)")
result = connection.execute("SELECT * FROM example")
for item in result.fetchall():
print(item)
AsyncIO extension
from sqlalchemy import text
from sqlalchemy.ext.asyncio import create_async_engine
engine = create_async_engine("asyncio+firebolt://email@domain:password@sample_database/sample_engine")
async with engine.connect() as conn:
await conn.execute(
text(f"INSERT INTO example(dummy) VALUES (11)")
)
result = await conn.execute(
text(f"SELECT * FROM example")
)
print(result.fetchall())
await engine.dispose()
Limitations
- Transactions are not supported since Firebolt database does not support them at this time.
- Parametrised calls to execute and executemany are not implemented.
Contributing
See: CONTRIBUTING.MD
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
firebolt_sqlalchemy-0.1.0.tar.gz
(11.5 kB
view hashes)
Built Distribution
Close
Hashes for firebolt_sqlalchemy-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87880f434cce06bbabb0e9926f5a4e1af58513d91a030bdd195fc39befd96c69 |
|
MD5 | f30823aab60d7a9a42cf4ce03f14c31b |
|
BLAKE2b-256 | 12fe3f8dc1c53216e966e59e8d198483cf75a6def297987e0f9b76b04dec7a3f |
Close
Hashes for firebolt_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e06a41e75d9cef650f8559756f29a83fe50c4edb51d00cbe222a8d558bf63c10 |
|
MD5 | df2758651ea73a4f3e8ee50512b01712 |
|
BLAKE2b-256 | f835a5ada8fe2442994d043bba876a667f97442336a6e5b54accd8fa108ec8dc |