SQLAlchemy CRUD.
Project description
sacrud
SACRUD will solve your problem of CRUD interface for SQLAlchemy. Originally created for pyramid_sacrud , but then in a separate project
Look how easy it is to use:
CREATE
from .models import DBSession, Groups
from sacrud.action import CRUD
data = {'name': 'Electronics',
'parent_id': '10',}
group_obj = CRUD(DBSession, Groups).create(data)
print(group_obj.name)
READ
from .models import DBSession, Groups
from sacrud.action import CRUD
group_obj = CRUD(DBSession, Groups).read()
print(group_obj.name)
UPDATE
from .models import DBSession, Groups
from sacrud.action import CRUD
group_obj = CRUD(DBSession, Groups).update(1, {'name': 'Chemistry'})
print(group_obj.name)
DELETE
from .models import DBSession, Groups
from sacrud.action import CRUD
CRUD(DBSession, Groups).delete(1)
Wraps your SQLAlchemy session
from sqlalchemy.orm import scoped_session, sessionmaker
from sacrud import crud_sessionmaker
DBSession = crud_sessionmaker(scoped_session(sessionmaker()))
help(DBSession.sacrud)
Now CRUD available from DBSession.
group_obj = DBSession.sacrud(Groups).create(data)
print(group_obj.name)
Installation
Install from github:
pip install git+http://github.com/ITCase/sacrud.git
PyPi:
pip install sacrud
Source:
python setup.py install
Contribute
Issue Tracker: http://github.com/ITCase/sacrud/issues
Source Code: http://github.com/ITCase/sacrud
Support
If you are having issues, please let me know. I have a mailing list located at sacrud@uralbash.ru and IRC channel #sacrud
License
The project is licensed under the MIT license.
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
sacrud-0.2.2.tar.gz
(13.6 kB
view hashes)