Sqlalchemy utilities for Takumi
Project description
Sqlachmey utilities for Takumi.
Add Settings
The setting DB_SETTINGS must be defined in settings module.
DB_SETTINGS = {
'test_db': {'dsn': 'sqlite:///:memory:'}
}
Init App
It’s not required to init app before using db. But it’s recommended to init app first:
db.init_app(app)
Query Database
The object db should be used to query database. And the only preferred way to query database is to use the context manager:
with db['test_db'] as session:
session.query(User).all()
# or to use a different binding
with db['test_db'].using_bind('master') as s:
s.query(User).all()
# or to tag the query
with db['test_db'].tag(hello=123, world=90) as s:
s.query(User).all()
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
Built Distribution
Close
Hashes for takumi_sqlalchemy-0.1.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39e1fb7630b3153c140e50cf7fefb36b9c478192b420837ef71bbc27fde82f08 |
|
MD5 | bd347ea42ab12039a38d0c9071c1d36f |
|
BLAKE2b-256 | 1b536a3e858b55db6b6a9af0ccf227f15365163feb577f17f886e4751d1df7e1 |