You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/usr/bin/env python
|
|
|
|
__doc__ = """
|
|
|
|
(c) 2018 - 2021 data-transport
|
|
|
|
steve@the-phi.com, The Phi Technology LLC
|
|
|
|
https://dev.the-phi.com/git/steve/data-transport.git
|
|
|
|
|
|
|
|
This program performs ETL between 9 supported data sources : Couchdb, Mongodb, Mysql, Mariadb, PostgreSQL, Netezza,Redshift, Sqlite, File
|
|
|
|
Usage :
|
|
|
|
transport --config <path-to-file.json> --procs <number-procs>
|
|
|
|
@TODO: Create tables if they don't exist for relational databases
|
|
|
|
"""
|
|
|
|
import pandas as pd
|
|
|
|
import numpy as np
|
|
|
|
import json
|
|
|
|
import sys
|
|
|
|
import transport
|
|
|
|
import time
|
|
|
|
from multiprocessing import Process
|
|
|
|
SYS_ARGS = {}
|
|
|
|
if len(sys.argv) > 1:
|
|
|
|
|
|
|
|
N = len(sys.argv)
|
|
|
|
for i in range(1,N):
|
|
|
|
value = None
|
|
|
|
if sys.argv[i].startswith('--'):
|
|
|
|
key = sys.argv[i][2:] #.replace('-','')
|
|
|
|
SYS_ARGS[key] = 1
|
|
|
|
if i + 1 < N:
|
|
|
|
value = sys.argv[i + 1] = sys.argv[i+1].strip()
|
|
|
|
if key and value and not value.startswith('--'):
|
|
|
|
SYS_ARGS[key] = value
|
|
|
|
|
|
|
|
|
|
|
|
i += 2
|
|
|
|
|
|
|
|
class Post(Process):
|
|
|
|
def __init__(self,**args):
|
|
|
|
super().__init__()
|
|
|
|
self.PROVIDER = args['target']['type']
|
|
|
|
self.writer = transport.factory.instance(**args['target'])
|
|
|
|
self.rows = args['rows']
|
|
|
|
def run(self):
|
|
|
|
|
|
|
|
handler = transport.factory.instance(**_args['store'])
|