Skip to main content

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.

  1. 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
  1. 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_function should return SyncResult

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)

Source distribution for django-sync-model 0.7.0
File Size Uploaded
django_sync_model-0.7.0.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-sync-model 0.7.0
File Interpreter ABI Platform
django_sync_model-0.7.0-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.5.2

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page