Skip to main content

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.

  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,
        }
)
  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 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

django_sync_model-0.3.0.tar.gz (8.0 kB view hashes)

Uploaded Source

Built Distribution

django_sync_model-0.3.0-py3-none-any.whl (10.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page