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
Metadata
Release files for django-sync-model 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_sync_model-0.7.0.tar.gz | 9.5 kB | Without provenance | Details for django_sync_model-0.7.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_sync_model-0.7.0-py3-none-any.whl | Python 3 | none | any | Details for django_sync_model-0.7.0-py3-none-any.whl |
Total release size: 23.3 kB
Release files / django_sync_model-0.7.0.tar.gz
| Download URL | django_sync_model-0.7.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c5f37035cc41262505f41f19b5aebdbfd790041568db746166d87181b359ba2
|
|
BLAKE2b-256 checksum How to use checksums |
e52e0ea4cbeb695350a824bdf9f60bddc89abf2045f560a48c00234edd304a39
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Release files / django_sync_model-0.7.0-py3-none-any.whl
| Download URL | django_sync_model-0.7.0-py3-none-any.whl |
|---|---|
| Size | 13.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
77a3911471dbfcf142302094be23b83861fa9c7f6397e1988b7b6982f4219827
|
|
BLAKE2b-256 checksum How to use checksums |
69bff7b51571c38b3b59728b1f51457980bab94db459e5e61191084cd6a14255
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.27.0
|
Security for django-sync-model 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.