Automatic migrations for SQLAlchemy
Project description
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
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
File details
Details for the file sqlsugar-0.1.tar.gz
.
File metadata
- Download URL: sqlsugar-0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8eb32e5623450b2b80fadb8110d291724bc970067c257406327618cc1245b81 |
|
MD5 | de808b571f7ea28edc973e8e490dddba |
|
BLAKE2b-256 | 6df4a35320cdce26d68c93b76888e2291bb9aab4d8f94870d34a09dd2d03f48c |
Provenance
File details
Details for the file sqlsugar-0.1-py3-none-any.whl
.
File metadata
- Download URL: sqlsugar-0.1-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 210c7425fcd30e1d46faab7b3d2a6a8b0609b25328a5438dbdf40598198ac228 |
|
MD5 | 74084f3417dcf80b39cbb3e729236ff4 |
|
BLAKE2b-256 | 303d64ab39f1c7c6427599544ef88724364553490d9c3bcc49ce4f632cd05fa4 |