Compare commits
No commits in common. "master" and "v0.2.1" have entirely different histories.
4 changed files with 12 additions and 44 deletions
|
@ -3,4 +3,4 @@
|
||||||
|
|
||||||
Wutta Framework for data import/export and real-time sync
|
Wutta Framework for data import/export and real-time sync
|
||||||
|
|
||||||
See docs at https://docs.wuttaproject.org/wuttasync/
|
See docs at https://rattailproject.org/docs/wuttasync/
|
||||||
|
|
|
@ -30,7 +30,6 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||||
|
|
||||||
intersphinx_mapping = {
|
intersphinx_mapping = {
|
||||||
'python': ('https://docs.python.org/3/', None),
|
'python': ('https://docs.python.org/3/', None),
|
||||||
'rattail-manual': ('https://docs.wuttaproject.org/rattail-manual/', None),
|
|
||||||
'wuttjamaican': ('https://docs.wuttaproject.org/wuttjamaican/', None),
|
'wuttjamaican': ('https://docs.wuttaproject.org/wuttjamaican/', None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,51 +2,22 @@
|
||||||
WuttaSync
|
WuttaSync
|
||||||
=========
|
=========
|
||||||
|
|
||||||
This provides a "batteries included" way to handle data sync between
|
This package adds data import/export and real-time sync utilities for
|
||||||
arbitrary source and target.
|
the `Wutta Framework <https://wuttaproject.org>`_.
|
||||||
|
|
||||||
This builds / depends on :doc:`WuttJamaican <wuttjamaican:index>`, for
|
*(NB. the real-time sync has not been added yet.)*
|
||||||
sake of a common :term:`config object` and :term:`handler` interface.
|
|
||||||
It was originally designed for import to / export from the :term:`app
|
|
||||||
database` but **both** the source and target can be "anything" -
|
|
||||||
e.g. CSV or Excel file, cloud API, another DB.
|
|
||||||
|
|
||||||
The basic idea is as follows:
|
The primary use cases in mind are:
|
||||||
|
|
||||||
* read a data set from "source"
|
* keep operational data in sync between various business systems
|
||||||
* read corresonding data from "target"
|
* import data from user-specified file
|
||||||
* compare the two data sets
|
* export to file
|
||||||
* where they differ, create/update/delete records on the target
|
|
||||||
|
|
||||||
Although in some cases (e.g. export to CSV) the target has no
|
This isn't really meant to replace typical ETL tools; it is smaller
|
||||||
meaningful data so all source records are "created" on / written to
|
scale and (hopefully) more flexible.
|
||||||
the target.
|
|
||||||
|
|
||||||
.. note::
|
While it of course supports import/export to/from the Wutta :term:`app
|
||||||
|
database`, it may be used for any "source → target" data flow.
|
||||||
You may already have guessed, that this approach may not work for
|
|
||||||
"big data" - and indeed, it is designed for "small" data sets,
|
|
||||||
ideally 500K records or smaller. It reads both (source/target)
|
|
||||||
data sets into memory so that is the limiting factor.
|
|
||||||
|
|
||||||
You can work around this to some extent, by limiting the data sets
|
|
||||||
to a particular date range (or other "partitionable" aspect of the
|
|
||||||
data), and only syncing that portion.
|
|
||||||
|
|
||||||
However this is not meant to be an ETL engine involving a data
|
|
||||||
lake/warehouse. It is for more "practical" concerns where some
|
|
||||||
disparate "systems" must be kept in sync, or basic import from /
|
|
||||||
export to file.
|
|
||||||
|
|
||||||
The general "source → target" concept can be used for both import and
|
|
||||||
export, since "everything is an import" from the target's perspective.
|
|
||||||
|
|
||||||
In addition to the import/export framework proper, a CLI framework is
|
|
||||||
also provided.
|
|
||||||
|
|
||||||
A "real-time sync" framework is also (eventually) planned, similar to
|
|
||||||
the one developed in the Rattail Project;
|
|
||||||
cf. :doc:`rattail-manual:data/sync/index`.
|
|
||||||
|
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
|
|
|
@ -563,7 +563,6 @@ class Importer:
|
||||||
|
|
||||||
:returns: List of target records which were deleted.
|
:returns: List of target records which were deleted.
|
||||||
"""
|
"""
|
||||||
model_title = self.get_model_title()
|
|
||||||
deleted = []
|
deleted = []
|
||||||
changes = changes or 0
|
changes = changes or 0
|
||||||
|
|
||||||
|
@ -578,7 +577,6 @@ class Importer:
|
||||||
obj = cached['object']
|
obj = cached['object']
|
||||||
|
|
||||||
# delete target object
|
# delete target object
|
||||||
log.debug("deleting %s %s: %s", model_title, key, obj)
|
|
||||||
if self.delete_target_object(obj):
|
if self.delete_target_object(obj):
|
||||||
deleted.append((obj, cached['data']))
|
deleted.append((obj, cached['data']))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue