Registry / database / spring-data-sqlachemy

spring-data-sqlachemy

JSON →
library0.1.4pypypiunverified

Spring Data SQLAlchemy (v0.1.4) brings Spring Data-style repository patterns to Python's SQLAlchemy. It provides automatic query generation from method names, dynamic queries with Example/QueryByExample, and integration with SQLAlchemy async sessions. Designed for projects requiring a familiar Spring Data DSL while using SQLAlchemy ORM.

pip install spring-data-sqlachemy
INSTALL
IMPORT
SIG · SPRING-DATA-SQLACH
S
spring-data-sqlachemy
databasepythonv0.1.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SpringDataRepository
from springdata_sqlalchemy import SpringDataRepository
from spring_data_sqlalchemy import SpringDataRepository

Minimal example: define a SQLAlchemy model, create a repository, save an entity.

from spring_data_sqlalchemy import SpringDataRepository from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) email = Column(String) engine = create_engine('sqlite:///:memory:') Base.metadata.create_all(engine) class UserRepository(SpringDataRepository[User]): entity = User repo = UserRepository(session_factory=engine.connect) user = User(name='Alice', email='alice@example.com') repo.save(user) print(user.id) # 1
Debug
Known issues
gotchaSession factory must be a callable returning a Session, not a Session instance. Passing a Session object will cause 'session is already closed' errors.
fix
Use session_factory=engine.connect (or lambda: Session(engine)).
affects: 0.1.x
breakingQueryByExample with composite keys may raise AttributeError if the entity's __table__.primary_key.columns contains multiple columns.
fix
Ensure your entity has a single primary key or override the find method.
affects: 0.1.4
deprecatedThe dynamic finder methods (e.g., findByName_ignoreCase) are experimental and may change signature or behavior in future releases.
fix
Use QueryByExample for complex queries; avoid relying on method name parsing for production.
affects: 0.1.x
Upgrade
Version history
0.1.4latest on PyPI · released Dec 22, 2022
Audit
Dependencies
sqlalchemyrequiredCore ORM dependency
Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
1
Resources
spring-data-sqlachemy — pip install spring-data-sqlachemy · libregistry