bug fix: export uses newer data-transport

dev
Steve Nyemba 2 years ago
parent 5d7aa7cd81
commit 1801e3a85d

@ -191,6 +191,7 @@ def init_sql(**_args):
_config = jsonmerge.merge(_config,CUSTOM_CONFIG[TYPE]) _config = jsonmerge.merge(_config,CUSTOM_CONFIG[TYPE])
# #
_info = meta(_config) _info = meta(_config)
_projectSQLite = [] #-- sqlite projection _projectSQLite = [] #-- sqlite projection
for field_name in _info['main'] : for field_name in _info['main'] :
_projectSQLite += ["json_extract(data,'$."+field_name+"') "+field_name] _projectSQLite += ["json_extract(data,'$."+field_name+"') "+field_name]
@ -211,12 +212,17 @@ def init_sql(**_args):
SQL = "SELECT DISTINCT :fields FROM "+TABLE_NAME+", json_each(data) x, json_each(x.value) i where x.key = ':table'" SQL = "SELECT DISTINCT :fields FROM "+TABLE_NAME+", json_each(data) x, json_each(x.value) i where x.key = ':table'"
SQL = SQL.replace(":table",table).replace(":fields",",".join(project)) SQL = SQL.replace(":table",table).replace(":fields",",".join(project))
r += [{"table":table,"read":{"sql":SQL},"sql":create(table=table,key='claim_id',fields=fields)}] r += [{"table":table,"read":{"sql":SQL},"sql":create(table=table,key='claim_id',fields=fields)}]
return r return r
def init(**_args): def init(**_args):
if 'provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'sqlite' : # if 'provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'sqlite' :
return init_sql(**_args) # return init_sql(**_args)
else: # else:
# return init_mongo(**_args)
if ('provider' in CONFIG['store'] and CONFIG['store']['provider'] == 'mongo') or ('type' in CONFIG['store'] and 'mongo' in CONFIG['store']['type']):
return init_mongo(**_args) return init_mongo(**_args)
else:
return init_sql(**_args)
def init_mongo (**_args) : def init_mongo (**_args) :
""" """
This function is intended to determine the number of tables to be created, as well as their type. This function is intended to determine the number of tables to be created, as well as their type.
@ -330,6 +336,7 @@ class Factory:
job_args = init(type=X12_TYPE) #-- getting the queries that will generate the objects we are interested in job_args = init(type=X12_TYPE) #-- getting the queries that will generate the objects we are interested in
# print (json.dumps(job_args)) # print (json.dumps(job_args))
_jobs = [] _jobs = []
for row in job_args: for row in job_args:
# _store = json.loads(json.dumps(wstore)) # _store = json.loads(json.dumps(wstore))
_store = copy.deepcopy(wstore) _store = copy.deepcopy(wstore)

Loading…
Cancel
Save