1

Update README.md

This commit is contained in:
Kim Wittenburg
2020-07-22 11:15:46 +02:00
parent 2f4c6d4908
commit ce50e7f93b

View File

@@ -1,3 +1,36 @@
# alembic-data
Data Migrations for Alembic/SQLAlchemy.
Data Migrations for Alembic/SQLAlchemy.
## State of this Project
This project was originally written as part of Karman but then abandoned in the process of migrating to non-relational databases. No further development will be done.
## Usage
When declaring models you can register specific object instances to be created during migrations. Currently the detection of changes is very rudimentary.
```python
from alembic_data import *
class Model:
...
register_object(Model(...))
register_object(Model(...))
```
Alternatively you can declare a model as a *managed model*. A managed models instances will be exclusively created by alembic-data. This is probably the most useful application. This way alembic-data can make sure that only objects created via `register_object` will exist in the database.
```python
from alembic_data import *
@managed_model
class Model:
...
register_object(Model(...))
register_object(Model(...))
# There will only be 2 instances of Model
```