Skip to main content

A tool to sync data across data sources

Project description

pyFission

Description

pyFission syncs tables/schemas across databases as defined in the configs/fission.py file. If src_table and src_schema args are not provided, it will sync all tables and schemas specified in the fission.py config file by summoning multiple bash commands in parallel.

The pyfission module has 2 methods of syncing tables -

  1. full: truncate + full sync of table, as name suggests
  2. incremental: syncs changes based on primary key and replication key provided in fission.py config file

pyFission automatically detects and builds the schema definition for tables, including nested and repeated fields for JSON-like schemas e.g:- BigQuery. Also, pyFission patches tables automatically if any new fields are added.

Getting started

Usage

  • Modify configs/custom_config.py and configs/fission.py with DB creds and sync config respectively
  • Add service account private key files/secrets to secrets_storage dir if needed
$ python -m pyfission --src [] --dest [] sync --help
usage: __main__.py pyfission [-h] [--src_table SRC_TABLE]
                          [--src_schema SRC_SCHEMA] [--src_db SRC_DB]
                          [--dest_table DEST_TABLE]
                          [--dest_schema DEST_SCHEMA] [--dest_db DEST_DB]
                          [--method {full,incremental}]
                          [--out_format {csv,json}]

optional arguments:
  -h, --help            show this help message and exit
  --src_table SRC_TABLE
                        Overrides table definition from pyfission configs
  --src_schema SRC_SCHEMA
                        Overrides schema definition from pyfission configs
  --src_db SRC_DB       Overrides database definition from pyfission configs
  --dest_table DEST_TABLE
                        Overrides table definition from pyfission configs
  --dest_schema DEST_SCHEMA
                        Overrides schema definition from pyfission configs
  --dest_db DEST_DB     Overrides database definition from pyfission configs
  --method {full,incremental}
                        Method of Replication
  --out_format {csv,json}
                        Format of output files
  • Recommended out_format:

    • json for BigQuery
    • csv for others
  • To sync a particular table - specify the src_schema and src_table args

    • dest_table will have same name as src_table unless explicitly specified
    • dest_schema will be set from fission.py config file's fission_dest dict
    • src_db and dest_db will derived from src and dest
python -m pyfission --src [] --dest [] sync --src_table [] --src_schema [] --out_format []
  • To sync an entire DB - only provide src and dest args
python -m pyfission --src [] --dest [] sync --out_format []

Installation

pip install pyfission

Contribution/Local installation

  1. Clone the repo
$ git clone https://github.com/nishantnath/pyfission.git
  1. Change the working directory to fission
$ cd pyfission
  1. Install python3 and the requirements if they don't exist
$ pip install -r requirements.txt

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

pyFission-1.0.2.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyFission-1.0.2-py3-none-any.whl (33.8 kB view details)

Uploaded Python 3

File details

Details for the file pyFission-1.0.2.tar.gz.

File metadata

  • Download URL: pyFission-1.0.2.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for pyFission-1.0.2.tar.gz
Algorithm Hash digest
SHA256 91c7189e2f66bc8c042ffeb87e7cb7b436e712b630aeda1f33664496b3fa142a
MD5 be7c45407b4ba5d422166fcbf434f2ee
BLAKE2b-256 64403eee14e6afab19364b683d256bae031d056e59a2840661b7acb8f732884f

See more details on using hashes here.

File details

Details for the file pyFission-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: pyFission-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for pyFission-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e30cf517f48a69ff9b3fa2b9ad7d90b70b3804a91d78b115006e8a59f1aa087
MD5 a8de2fb7edb5b68de19f223b720380ad
BLAKE2b-256 5c44201246c0fd0768c4183b2d09ba450d4e80a085eda754b32b436513762047

See more details on using hashes here.

Supported by

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