mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
merged codbase and wrote some new database writing
This commit is contained in:
@@ -29,6 +29,7 @@ from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy import null
|
||||
import googlemaps
|
||||
import env
|
||||
import inspect
|
||||
Base = declarative_base()
|
||||
|
||||
##################################################################################################
|
||||
@@ -660,15 +661,18 @@ def write_to_database(data, local_outputs):
|
||||
Returns:
|
||||
Data: The data that was written to the database.
|
||||
"""
|
||||
|
||||
column_list=[]
|
||||
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',
|
||||
'dictPostComplete']
|
||||
cols2 = ["num","name", "comment", 'rating','picsURL','picsLocalpath','source','date',
|
||||
'address','dictPostComplete']
|
||||
#df = pd.DataFrame(local_outputs["xls"], columns=cols)
|
||||
df = pd.DataFrame(local_outputs['xlsdf'])
|
||||
# df = pd.DataFrame(local_outputs['xlsdf'].values, columns=cols2)
|
||||
# df = pd.DataFrame(local_outputs['xlsdf'])
|
||||
df = pd.DataFrame(local_outputs['xlsdf'].values, columns=column_list)
|
||||
df2 = pd.DataFrame(local_outputs['posts'])
|
||||
# print ('Dropped items not included in sync to database: ',df2.dropna(inplace=True))
|
||||
# rows = list(data)
|
||||
|
||||
Reference in New Issue
Block a user