No project description provided
Project description
django-sync-model
a django reusable application to migrate data from source table to target table.
Install
pip3 install django-sync-model
add sync_model
to INSTALLED_APPS
in settings.py
Usage
for example you may has connected to a stock database provided by the broker.
you want to save some filtered data to your own database to create foreignkey.
- create a sync task
from sync_model.models import (
RawStockAction, StockAction,
SyncTask,
)
SyncTask.objects.create(
source=ContentType.objects.get_for_model(RawStockAction),
target=ContentType.objects.get_for_model(StockAction),
sync_method="sync_model.utils.sync_raw_stock_action",
batch_size=2,
order_by=["update_datetime", "-sender"],
filter_by={
"canceled": False,
}
)
- run sync task
python3 manage.py sync_model
Features
- support sync data from one database to another
- incremental update
- support non-cycle dependency
- support filter
- support custom sync size of each table
- support exclude filters
- support timeout parameter
Project details
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
Close
Hashes for django_sync_model-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68cb2e6c6e6cea87209ac08a06ca5e73e9ad9ed2ae1b936589e6c0202b93d1e2 |
|
MD5 | 0980e577d7d6e5ee47065a11b4caedeb |
|
BLAKE2b-256 | d364280a1d4909c8efeecf44c33fa4746bafc3d733df03e1b81c6ff09addcae6 |