SQLAlchemy SurrealDB Dialect
English | 简体中文
⚠️ Experimental Stage: This project is in an experimental stage. Breaking changes may occur at any time. Use in production at your own risk.
A SQLAlchemy dialect for SurrealDB.
Installation
uv add sqlalchemy-surrealdb
# or
pip install sqlalchemy-surrealdb
Connection String
surrealdb://username:password@host:port/database
Example:
from sqlalchemy import create_engine
engine = create_engine("surrealdb://root:root@127.0.0.1:5070/test")
Usage
from sqlalchemy import Column, String, Integer, create_engine
from sqlalchemy.orm import declarative_base, sessionmaker
from sqlalchemy_surrealdb.types import SurrealRecordID
from surrealdb import RecordID
import uuid
Base = declarative_base()
class User(Base):
__tablename__ = "users"
id = Column(
SurrealRecordID,
primary_key=True,
default=lambda: RecordID("users", uuid.uuid4().hex),
)
username = Column(String(50), unique=True, nullable=False)
email = Column(String(120), unique=True, nullable=False)
age = Column(Integer, nullable=True)
# Create tables
engine = create_engine("surrealdb://root:root@127.0.0.1:5070/test")
Base.metadata.create_all(bind=engine)
# Use session
SessionLocal = sessionmaker(bind=engine, expire_on_commit=False)
session = SessionLocal()
# CRUD operations
user = User(username="alice", email="alice@example.com", age=25)
session.add(user)
session.commit()
Features
- Basic CRUD operations
- SQLAlchemy ORM support
- Custom
SurrealRecordIDtype for SurrealDB RecordID handling
Limitations
- Complex expressions have not yet been fully tested
- Asynchronous operations are not yet supported
- SQL statement construction currently inherits from SQLAlchemy and modifies the results, which may lead to unexpected issues and result in a performance overhead
Requirements
- Python >= 3.9
- SQLAlchemy >= 2.0
- SurrealDB server running (tested with SurrealDB 3.0.4)
License
AGPL-v3.0
Metadata
Release files for sqlalchemy-surrealdb 0.1.1
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 |
|---|---|---|---|---|
| sqlalchemy_surrealdb-0.1.1.tar.gz | 10.1 kB | Without provenance | Details for sqlalchemy_surrealdb-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqlalchemy_surrealdb-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for sqlalchemy_surrealdb-0.1.1-py3-none-any.whl |
Total release size: 22.4 kB
Release files / sqlalchemy_surrealdb-0.1.1.tar.gz
| Download URL | sqlalchemy_surrealdb-0.1.1.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2bf1362d5620297555f3d9b64dac7c96d32a0bbbe6ccae634d7a71bb98490ca
|
|
BLAKE2b-256 checksum How to use checksums |
e0d76712d3cf63006344f4f7e6dd0e5f5bd7fd01f44652dd57dddc6ae67df262
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sqlalchemy_surrealdb-0.1.1-py3-none-any.whl
| Download URL | sqlalchemy_surrealdb-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd7d9665e1c5b0f60161d277cab944d6c7732befa8705767ce6cd34414a8d535
|
|
BLAKE2b-256 checksum How to use checksums |
e87b62a22ac55cde53ca2d57c10229df7dee47de21fa56e343bb5fe9394cd2a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for sqlalchemy-surrealdb 0.1.1
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.