feature: use of cache with override feature, export, removing duplicate columns on creating a table

This commit is contained in:
Steve Nyemba 2021-03-13 20:38:17 -06:00
parent bb7db7ffea
commit 2ffe827063
4 changed files with 10 additions and 4 deletions

View File

@ -125,7 +125,7 @@ def meta(config) :
def create (**_args) : def create (**_args) :
skip = [] if 'skip' not in _args else _args['skip'] skip = [] if 'skip' not in _args else _args['skip']
fields = ([_args['key']] if 'key' in _args else []) + _args['fields'] fields = ([_args['key']] if 'key' in _args else []) + _args['fields']
fields = ['_id'] + fields fields = ['_id'] + list(set(fields))
table = _args['table'] table = _args['table']
sql = ['CREATE TABLE :table ',"(",",\n".join(["\t".join(["\t",name,"VARCHAR(125)"]) for name in fields]),")"] sql = ['CREATE TABLE :table ',"(",",\n".join(["\t".join(["\t",name,"VARCHAR(125)"]) for name in fields]),")"]
return " ".join(sql) return " ".join(sql)

View File

@ -128,7 +128,7 @@ class CreateSQL(Worker) :
# log = {"context":self.name(),"args":{"table":self._info['args']['table'],"sql":self._sql}} # log = {"context":self.name(),"args":{"table":self._info['args']['table'],"sql":self._sql}}
log = {"context":self.name(),"args":{"table":sqltable,"sql":self._sql.replace(":table",sqltable)}} log = {"context":self.name(),"args":{"table":sqltable,"sql":self._sql.replace(":table",sqltable)}}
try: try:
writer = transport.factory.instance(**self._info) writer = transport.factory.instance(**self._info)
writer.apply(self._sql.replace(":table",sqltable)) writer.apply(self._sql.replace(":table",sqltable))

View File

@ -422,7 +422,13 @@ class Parser (Process):
# else: # else:
# value[label].append(tmp) # value[label].append(tmp)
tmp['_index'] = len(value[label]) -1 if '_index' not in tmp :
#
# In case we asked it to be overriden, then this will not apply
# X12 occasionally requires references to other elements in a loop (alas)
#
tmp['_index'] = len(value[label]) -1
elif 'field' in _info : elif 'field' in _info :
name = _info['field'] name = _info['field']

View File

@ -8,7 +8,7 @@ import sys
def read(fname): def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() return open(os.path.join(os.path.dirname(__file__), fname)).read()
args = { args = {
"name":"healthcareio","version":"1.6.3.3", "name":"healthcareio","version":"1.6.3.4",
"author":"Vanderbilt University Medical Center", "author":"Vanderbilt University Medical Center",
"author_email":"steve.l.nyemba@vumc.org", "author_email":"steve.l.nyemba@vumc.org",
"include_package_data":True, "include_package_data":True,