SQLRamen provides a convenient way to map Python objects to relational database tables, with no declarative code of any kind. It's built on top of the SQLAlchemy ORM and provides a super-minimalistic interface to an existing database.
Project description
SQLSoup is no longer supported and does not work with modern versions of SQLAlchemy. For modern support of ad-hoc models based on database reflection, please refer to the automap feature at: https://docs.sqlalchemy.org/en/stable/orm/extensions/automap.html
SQLRamen intends to be a replacement to SQLSoup with a different API
SQLRamen
SQLRamen provides a convenient way to map Python objects to relational database tables, with no declarative code of any kind. It's built on top of the SQLAlchemy ORM and provides a super-minimalistic interface to an existing database.
Usage is as simple as:
from sqlramen import *
db = SQLRamen("sqlite:///../pdca/aide")
user = db.query(db.table.user).filter_by(email="j@j.com").one()
[ l.message for l in user.comment_collection ]
# ['SCAM Manual\r\n\r\nA complete guide to create a guide with scam',
# ...
# 'future plan',
# 'further down']
db.query(db.table.comment.message).join(db.table.comment.user
).filter(db.table.user.email=="j@j.com").all()
# same
print([l for l in db.table.user.__table__.c])
# [Column('id', INTEGER(), table=<user>, primary_key=True, nullable=False),
# Column('pic_file', TEXT(), table=<user>),
# Column('name', TEXT(), table=<user>, nullable=False),
# Column('email', TEXT(), table=<user>, nullable=False),
# Column('secret_token', TEXT(), table=<user>),
# Column('secret_password', TEXT(), table=<user>, nullable=False)]
db.raw("select * from comment limit 5").all()
#[('2025-01-12 12:52:09', 1, 1, None, 'SCAM Manual\r\n\r\nA complete guide to create a guide with scam', None, 'story'),
# ('2025-01-12 13:28:14', 2, 1, 1, 'Synopsis\r\n\r\nA frontend to a pandoc toolchain to build a book in a supposedly new way.', None, 'story_item'),
# ('2025-01-12 13:28:47', 3, 1, 1, 'How to install and start it\r\n', None, 'story_item'),
# ('2025-01-12 13:29:48', 4, 1, 1, 'walkthrough to create this manual with the tool\r\n\r\nFirst post//landing page', None, 'story_item'),
# ('2025-01-12 13:30:23', 5, 1, 3, 'Quickstart', None, 'comment')]
db_introspect
Usage:
db_introspect sqlite:///../pdca/aide && xdot out.dot
# introspecting sqlite:///../pdca/aide
# nb col = 23
# nb fk = 7
# output available in out.dot
output:
Changelog
0.9.2//0.9.3
- improved README
0.9.1
- initial release
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlramen-0.9.3.tar.gz.
File metadata
- Download URL: sqlramen-0.9.3.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7129bce8bd058b37c68d26593dae5c10ce2fb648f2c97b42e3061a4a85e51b97
|
|
| MD5 |
6dd207ab5616dd6f5bbaa37304d9d19b
|
|
| BLAKE2b-256 |
0965ea2fdf4635259ff2fea445c2736433f3e75a37f8af5a2d5e3125225c85c3
|
File details
Details for the file sqlramen-0.9.3-py2.py3-none-any.whl.
File metadata
- Download URL: sqlramen-0.9.3-py2.py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2107ce767f348780f07c83fc9601e1b90ecdaa7163c32402730d3f175cf839ff
|
|
| MD5 |
dfb557a45cd5529416a229593f18d372
|
|
| BLAKE2b-256 |
ffcd5f9dba7ff3747365a40d932e325b77d82c20bf74bba4418eff5c3e103564
|