Flatten nested SQLAlchemy model data
Project description
SQLAlchemy Flattener
This tool allows you to have the DX of defining test data with the ORM - nested as deeply as you like - then recursively flattening that data to either python dicts for bulk inserts, or just raw SQL insert statements for maximum seeding speed between tests.
Works really well in conjunction with polyfactory
Usage
$ sqlflat --help
usage: sqlflat [-h] [--format {dict,sql}] instances order output
Flatten SQLAlchemy ORM instances.
positional arguments:
instances The module namespace containing the model instances, e.g. `foo.bar.instance_list`
order The module namespace containing a sequence of table insert ordering.
output The output file path to write the flattened data to.
options:
-h, --help show this help message and exit
--format {dict,sql} The format to write the data in.
Where insertion_ordering_list is a list of model classes or sqlalchemy.Table instances, but not declarative model instances.
Take a look at the examples directory.
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 sqlalchemy_flattener-0.5.0.tar.gz.
File metadata
- Download URL: sqlalchemy_flattener-0.5.0.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2936f16ada95fdd016fc8ff763e01516ad6624b8fed1999dd85a22b8847dd3c
|
|
| MD5 |
0b50b42a600fa860e02b801b97479850
|
|
| BLAKE2b-256 |
fa41d38daee12c67a1f59265a72e766dd4723cf4f5fefc1bd1ce5dbbcbd8556d
|
File details
Details for the file sqlalchemy_flattener-0.5.0-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_flattener-0.5.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf15da25c0ff259726dcb66969f9c94f5bdbfa92e9dce730c3ddff4525d5d8ba
|
|
| MD5 |
156d75d17bdfaa2d0683603c7ddc4bd6
|
|
| BLAKE2b-256 |
e982702fc2fb4b15efe4f7c137dcbd881e463d6329c50f0ffac4e95ca185db47
|