SQLSugar - Automatic migrations for SQLAlchemy
This library is for you if you want to use a real database without spending time to generate migrations. This is experimental and you should switch to Alembic as your project matures. This only supports adding new tables, columns and indexes.
Installation
Install this library using pip:
pip install sqlsugar
Usage
Look for examples with SQLAlchemy or SQLModel.
from sqlsugar import migrate
migrate(engine.connect(), Base.metadata)
How it works
We use Alembic to autogenerate the difference between the models you have defined with SQLAlchemy and the database. We then execute operations that create tables, add new columns or add new indexes. That is often all that's needed for rapid prototyping or running very small hobby projects.
However, we don't support renaming columns, dropping columns or removing tables. You should switch to using Alembic as your needs evolve. Alternatively, you can try running those migrations manually.
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd sqlsugar
python -m venv .venv
source .venv/bin/activate
Now install the dependencies and test dependencies:
pip install -e '.[test]'
pre-commit install
To run the tests:
pytest
Metadata
Release files for sqlsugar 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sqlsugar-0.1.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sqlsugar-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / sqlsugar-0.1.tar.gz
| Download URL | sqlsugar-0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a8eb32e5623450b2b80fadb8110d291724bc970067c257406327618cc1245b81
|
|
BLAKE2b-256 checksum How to use checksums |
6df4a35320cdce26d68c93b76888e2291bb9aab4d8f94870d34a09dd2d03f48c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / sqlsugar-0.1-py3-none-any.whl
| Download URL | sqlsugar-0.1-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
210c7425fcd30e1d46faab7b3d2a6a8b0609b25328a5438dbdf40598198ac228
|
|
BLAKE2b-256 checksum How to use checksums |
303d64ab39f1c7c6427599544ef88724364553490d9c3bcc49ce4f632cd05fa4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|