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,
}
)
here your sync_method should return a sync result
- 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 foreign key sort
- support exclude filters
- support timeout parameter
- support None value
Release Notes
- 0.5.0
break change:
sync_functionshould returnSyncResult
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
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 django_sync_model-0.7.0.tar.gz.
File metadata
- Download URL: django_sync_model-0.7.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c5f37035cc41262505f41f19b5aebdbfd790041568db746166d87181b359ba2
|
|
| MD5 |
670f7429f77e0937c96f81864e809c78
|
|
| BLAKE2b-256 |
e52e0ea4cbeb695350a824bdf9f60bddc89abf2045f560a48c00234edd304a39
|
File details
Details for the file django_sync_model-0.7.0-py3-none-any.whl.
File metadata
- Download URL: django_sync_model-0.7.0-py3-none-any.whl
- Upload date:
- Size: 13.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77a3911471dbfcf142302094be23b83861fa9c7f6397e1988b7b6982f4219827
|
|
| MD5 |
d22479f9f5f3ae50fd7fd7ce66ce4020
|
|
| BLAKE2b-256 |
69bff7b51571c38b3b59728b1f51457980bab94db459e5e61191084cd6a14255
|