firebolt-sqlalchemy-0.9.1
توضیحات
Sqlalchemy adapter for Firebolt
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | firebolt-sqlalchemy-0.9.1 |
| نام | firebolt-sqlalchemy |
| نسخه کتابخانه | 0.9.1 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Firebolt |
| ایمیل نویسنده | pypi@firebolt.io |
| آدرس صفحه اصلی | https://github.com/firebolt-db/firebolt-sqlalchemy |
| آدرس اینترنتی | https://pypi.org/project/firebolt-sqlalchemy/ |
| مجوز | Apache-2.0 |
<p align="center">
<img width="761" alt="SQLAlchemy and Firebolt" src="https://user-images.githubusercontent.com/7674553/145249436-534b3cc0-2350-4f7e-9c56-78ffbcc0f003.png">
</p>
# firebolt-sqlalchemy
[](https://github.com/firebolt-db/firebolt-sqlalchemy/actions/workflows/unit-tests.yml)
[](https://github.com/firebolt-db/firebolt-sqlalchemy/actions/workflows/code-check.yml)
[](https://github.com/firebolt-db/firebolt-sqlalchemy/actions/workflows/security-scan.yml)
[](https://github.com/firebolt-db/firebolt-sqlalchemy/actions/workflows/python-integration-tests.yml)

The [Firebolt](https://www.firebolt.io/) dialect for [SQLAlchemy](https://www.sqlalchemy.org/). `firebolt-sqlalchemy` uses [Firebolt's Python SDK](https://github.com/firebolt-db/firebolt-python-sdk) which implements [PEP 249](https://www.python.org/dev/peps/pep-0249/).
* [SQLAlchemy Dialects](https://docs.sqlalchemy.org/en/14/dialects/index.html)
* [PyPI Package](https://pypi.org/project/firebolt-sqlalchemy/)
## Installation
Requires Python >=3.7.
```bash
pip install firebolt-sqlalchemy
```
## Connecting
Connection strings use the following structure:
```
firebolt://{username}:{password}@{database}[/{engine_name}][?account_name={name}}]
```
`engine_name` is optional. If omitted, Firebolt will use the default engine for the database.
`account_name` is optional. If omitted a default account will be used for connection.
Examples:
```
firebolt://email@domain:password@sample_database
firebolt://email@domain:password@sample_database/sample_engine
```
If a different account name is required, it can be specified in the connection string
```
firebolt://email@domain:password@sample_database/sample_engine?account_name=my_account
```
To override the API URL (e.g. for dev testing):
```bash
export FIREBOLT_BASE_URL=<your_url>
```
If your password contains % or / characters they need to be sanitised as per https://docs.sqlalchemy.org/en/14/core/engines.html#database-urls
```python
my_pass = "0920%/2"
import urllib.parse
new_pass = urllib.parse.quote_plus(my_pass)
```
## Quick Start
```python
import urllib.parse
from sqlalchemy import create_engine
password = urllib.parse.quote_plus("your_password_here")
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](https://docs.sqlalchemy.org/en/14/orm/extensions/asyncio.html) extension
```python
import urllib.parse
from sqlalchemy import text
from sqlalchemy.ext.asyncio import create_async_engine
password = urllib.parse.quote_plus("your_password_here")
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
1. Transactions are not supported since Firebolt database does not support them at this time.
1. Parametrised calls to execute and executemany are not implemented.
## Contributing
See: [CONTRIBUTING.MD](https://github.com/firebolt-db/firebolt-sqlalchemy/tree/master/CONTRIBUTING.MD)
نیازمندی
| مقدار | نام |
|---|---|
| >=0.9.2 | firebolt-sdk |
| >=1.0.0 | sqlalchemy |
| ==0.7.0 | devtools |
| ==2.0.2 | greenlet |
| ==4.0.3 | mock |
| ==0.910 | mypy |
| ==2.15.0 | pre-commit |
| ==6.2.5 | pytest |
| ==0.16.0 | pytest-asyncio |
| ==3.0.0 | pytest-cov |
| ==0.4 | sqlalchemy-stubs |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.7 | Python |
نحوه نصب
نصب پکیج whl firebolt-sqlalchemy-0.9.1:
pip install firebolt-sqlalchemy-0.9.1.whl
نصب پکیج tar.gz firebolt-sqlalchemy-0.9.1:
pip install firebolt-sqlalchemy-0.9.1.tar.gz