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://{client_id}:{client_secret}@{database}[/{engine_name}]?account_name={name}
engine_name is optional.
account_name is required.
Examples:
firebolt://aaa-bbb-ccc-222:$ecret@sample_database?account_name=my_account
firebolt://aaa-bbb-ccc-222:$ecret@sample_database/sample_engine?account_name=my_account
To override the API URL (e.g. for dev testing):
export FIREBOLT_BASE_URL=<your_url>
If your secret contains % or / characters they need to be sanitised as per https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls
my_secret = "0920%/2"
import urllib.parse
new_secret = urllib.parse.quote_plus(my_secret)
Connecting with Firebolt Core
Firebolt Core is free self-hosted version of Firebolt.
In order to connect to it you can provide a simplified version of the connection string:
firebolt://{database}?url={url}
{database} is you Firebolt Core database. By default this is firebolt
{url} is a fully qualified URL (with port) where your Firebolt Core is hosted. By default it's http://localhost:3473
If you are running Firebolt Core locally with defaults the connection string will be firebolt://firebolt?url=http://localhost:3473
Quick Start
import urllib.parse
from sqlalchemy import create_engine
secret = urllib.parse.quote_plus("your_secret_here")
engine = create_engine("firebolt://aaa-bbb-ccc-222:" + secret + "@sample_database/sample_engine?account_name=my_account")
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
import urllib.parse
from sqlalchemy import text
from sqlalchemy.ext.asyncio import create_async_engine
secret = urllib.parse.quote_plus("your_secret_here")
engine = create_async_engine("asyncio+firebolt://aaa-bbb-ccc-222:" + secret + "@sample_database/sample_engine?account_name=my_account")
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 right now.
- Parametrised calls to execute and executemany are not implemented.
Contributing
See: CONTRIBUTING.MD
Metadata
Release files for firebolt-sqlalchemy 1.1.2
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 |
|---|---|---|---|---|
| firebolt_sqlalchemy-1.1.2.tar.gz | 14.8 kB | Without provenance | Details for firebolt_sqlalchemy-1.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| firebolt_sqlalchemy-1.1.2-py3-none-any.whl | Python 3 | none | any | Details for firebolt_sqlalchemy-1.1.2-py3-none-any.whl |
Total release size: 28.3 kB
Release files / firebolt_sqlalchemy-1.1.2.tar.gz
| Download URL | firebolt_sqlalchemy-1.1.2.tar.gz |
|---|---|
| Size | 14.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12e3c364ca7aa7ce57165fa804aa94a79df0a2bcff6d86571312eb87851cbf90
|
|
BLAKE2b-256 checksum How to use checksums |
552a04fb00e836d6be4c7380c5d1958d0160f5def2c2f81acc5653a2643b9934
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / firebolt_sqlalchemy-1.1.2-py3-none-any.whl
| Download URL | firebolt_sqlalchemy-1.1.2-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
02a1019e09434c5748d28e2bdb3aac01b899877bf870ddc8c51d9359c964bd15
|
|
BLAKE2b-256 checksum How to use checksums |
a41e758468caaacfc5486b171ff9bdc6375256efb41fad143c92e94465698044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Security for firebolt-sqlalchemy 1.1.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.