dev
Steve Nyemba 3 years ago
parent e8edf886ad
commit 44d621941d

@ -380,7 +380,7 @@ class Generator (Learner):
_schema = self.get_schema() _schema = self.get_schema()
_schema = [{'name':_item.name,'type':(_item.field_type if has_attr(_item,'field_type') else 'VARCHAR(256)')} for _item in _schema] _schema = [{'name':_item.name,'type':_item.field_type} for _item in _schema]
_df = self.format(_df,_schema) _df = self.format(_df,_schema)
_log = [{"name":_schema[i]['name'],"dataframe":_df[_df.columns[i]].dtypes.name,"schema":_schema[i]['type']} for i in np.arange(len(_schema)) ] _log = [{"name":_schema[i]['name'],"dataframe":_df[_df.columns[i]].dtypes.name,"schema":_schema[i]['type']} for i in np.arange(len(_schema)) ]
self.log(**{"action":"consolidate","input":_log}) self.log(**{"action":"consolidate","input":_log})
@ -388,11 +388,10 @@ class Generator (Learner):
# w = transport.factory.instance(doc='observation',provider='mongodb',context='write',db='IOV01_LOGS',auth_file='/home/steve/dev/transport/mongo.json') # w = transport.factory.instance(doc='observation',provider='mongodb',context='write',db='IOV01_LOGS',auth_file='/home/steve/dev/transport/mongo.json')
# w.write(_df) # w.write(_df)
# cols = [name for name in _df.columns if name.endswith('datetime')] # cols = [name for name in _df.columns if name.endswith('datetime')]
# print (_df[cols]) # print (_df[cols])
writer = transport.factory.instance(**_store) writer = transport.factory.instance(**_store)
writer.write(_df,schema=[_item for _item in _schema if _item['name'] in cols]) writer.write(_df[:],schema=[_item for _item in _schema if _item['name'] in cols])

Loading…
Cancel
Save