SQLAlchemy adapter for superfunctions.db
Project description
superfunctions-sqlalchemy
SQLAlchemy adapter for superfunctions.db
Location: packages/python-sqlalchemy/
Package: superfunctions-sqlalchemy
Import: from superfunctions_sqlalchemy import create_adapter
Installation
pip install superfunctions-sqlalchemy
# With PostgreSQL
pip install superfunctions-sqlalchemy[postgres]
# With MySQL
pip install superfunctions-sqlalchemy[mysql]
# With async support
pip install superfunctions-sqlalchemy[asyncpg]
Usage
from sqlalchemy import create_engine
from superfunctions_sqlalchemy import create_adapter
# Create SQLAlchemy engine
engine = create_engine("postgresql://user:password@localhost/dbname")
# Create adapter
adapter = create_adapter(engine)
# Use with superfunctions libraries
from authfn import create_authfn, AuthFnConfig
auth = create_authfn(
AuthFnConfig(
database=adapter,
namespace="authfn",
)
)
Features
- ✅ Full CRUD operations
- ✅ Transaction support
- ✅ Batch operations
- ✅ Query builders (where, orderBy, limit, offset)
- ✅ All SQL operators
- ✅ Works with PostgreSQL, MySQL, SQLite
- ✅ Sync and async engines
Example
from sqlalchemy import create_engine
from superfunctions_sqlalchemy import create_adapter
from superfunctions.db import CreateParams, FindManyParams, WhereClause, Operator
engine = create_engine("postgresql://localhost/mydb")
adapter = create_adapter(engine)
# Create
user = await adapter.create(
CreateParams(
model="users",
data={"name": "Alice", "email": "alice@example.com"},
)
)
# Query
users = await adapter.find_many(
FindManyParams(
model="users",
where=[
WhereClause(field="email", operator=Operator.LIKE, value="%@example.com")
],
limit=10,
)
)
License
MIT
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 superfunctions_sqlalchemy-0.1.0.tar.gz.
File metadata
- Download URL: superfunctions_sqlalchemy-0.1.0.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e4edc30b044f3a5abe65be3155493e5fa034fd61bd02f66ae909485c99b27070
|
|
| MD5 |
a5fe4af80c1f0ce09cf97906de09671f
|
|
| BLAKE2b-256 |
d074ec8dde95b18c4b54bae4d2e6254b8b4c892002d2c7c1dfd783f0766b775a
|
File details
Details for the file superfunctions_sqlalchemy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: superfunctions_sqlalchemy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17567f809b972f21052a4335e5a5127efcf76fe3b9f8953ab106e41b777ec74c
|
|
| MD5 |
12a16dfebf3ff3744ed6f8e2d1abcce6
|
|
| BLAKE2b-256 |
49f5325d9986ebbf63a6f7472be8090336afe789004214cebdbcc01236274465
|