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
File details
Details for the file takumi_sqlalchemy-0.1.5.tar.gz
.
File metadata
- Download URL: takumi_sqlalchemy-0.1.5.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13999da292f98a2cfd2b09a0c6130c21ef571ba8f635f22b1f93b5600ff46a07 |
|
MD5 | 5cfaf19221ac45632249b83dcbdcf725 |
|
BLAKE2b-256 | 04ca3eadf58b5a5aef7d16ce171e32a00a8706aa0de90993c845c4c623044925 |
File details
Details for the file takumi_sqlalchemy-0.1.5-py2.py3-none-any.whl
.
File metadata
- Download URL: takumi_sqlalchemy-0.1.5-py2.py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b63e41657513066530a9c4803b0a586216d702ccb987db9da7b3cf04e9afafb0 |
|
MD5 | 2a7b86be3adf8f4a53dfc2fbdd8ec105 |
|
BLAKE2b-256 | fe28d2aca2fce79a35b1cd063f551aeb3e988a090acd980dd88e52fe7295386b |