merged codbase and wrote some new database writing

This commit is contained in:
Joe Steele
2024-06-19 22:47:02 -04:00
parent 7ec229de9f
commit 9e48f67e57
+7 -3
View File
@@ -29,6 +29,7 @@ from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import null from sqlalchemy import null
import googlemaps import googlemaps
import env import env
import inspect
Base = declarative_base() Base = declarative_base()
################################################################################################## ##################################################################################################
@@ -660,15 +661,18 @@ def write_to_database(data, local_outputs):
Returns: Returns:
Data: The data that was written to the database. Data: The data that was written to the database.
""" """
column_list=[]
print('write to database ...') print('write to database ...')
for x in inspect.getmembers(Posts):
if not (x[0].startswith('_') or 'metadata' in x[0]):
column_list.append(x[0])
cols = ["name", "comment", 'rating','picsURL','picsLocalpath','source','date','address', cols = ["name", "comment", 'rating','picsURL','picsLocalpath','source','date','address',
'dictPostComplete'] 'dictPostComplete']
cols2 = ["num","name", "comment", 'rating','picsURL','picsLocalpath','source','date', cols2 = ["num","name", "comment", 'rating','picsURL','picsLocalpath','source','date',
'address','dictPostComplete'] 'address','dictPostComplete']
#df = pd.DataFrame(local_outputs["xls"], columns=cols) #df = pd.DataFrame(local_outputs["xls"], columns=cols)
df = pd.DataFrame(local_outputs['xlsdf']) # df = pd.DataFrame(local_outputs['xlsdf'])
# df = pd.DataFrame(local_outputs['xlsdf'].values, columns=cols2) df = pd.DataFrame(local_outputs['xlsdf'].values, columns=column_list)
df2 = pd.DataFrame(local_outputs['posts']) df2 = pd.DataFrame(local_outputs['posts'])
# print ('Dropped items not included in sync to database: ',df2.dropna(inplace=True)) # print ('Dropped items not included in sync to database: ',df2.dropna(inplace=True))
# rows = list(data) # rows = list(data)