Skip to main content

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


Download files

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

Source Distribution

superfunctions_sqlalchemy-0.1.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

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

superfunctions_sqlalchemy-0.1.0-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file superfunctions_sqlalchemy-0.1.0.tar.gz.

File metadata

File hashes

Hashes for superfunctions_sqlalchemy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e4edc30b044f3a5abe65be3155493e5fa034fd61bd02f66ae909485c99b27070
MD5 a5fe4af80c1f0ce09cf97906de09671f
BLAKE2b-256 d074ec8dde95b18c4b54bae4d2e6254b8b4c892002d2c7c1dfd783f0766b775a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for superfunctions_sqlalchemy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17567f809b972f21052a4335e5a5127efcf76fe3b9f8953ab106e41b777ec74c
MD5 12a16dfebf3ff3744ed6f8e2d1abcce6
BLAKE2b-256 49f5325d9986ebbf63a6f7472be8090336afe789004214cebdbcc01236274465

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