mirror of
https://github.com/timberjoegithub/GoogleScrape.git
synced 2026-07-22 00:19:48 +00:00
more formatting
This commit is contained in:
@@ -598,11 +598,11 @@ def write_to_database(data, outputs):
|
|||||||
|
|
||||||
def database_update_row(review_name,column_name,column_value,update_style,outputs):
|
def database_update_row(review_name,column_name,column_value,update_style,outputs):
|
||||||
try:
|
try:
|
||||||
if update_style == "forceall":
|
if update_style == "forceall" and column_value != False:
|
||||||
outputs['postssession'].query(Posts).filter(Posts.name == review_name).update\
|
outputs['postssession'].query(Posts).filter(Posts.name == review_name).update\
|
||||||
({column_name : column_value})
|
({column_name : column_value})
|
||||||
print (' Force Updated ',column_name, ' to: ',column_value)
|
print (' Force Updated ',column_name, ' to: ',column_value)
|
||||||
elif update_style == "onlyempty":
|
elif update_style == "onlyempty" and column_value != False:
|
||||||
postval = outputs['postssession'].query(Posts).filter(Posts.name == review_name,\
|
postval = outputs['postssession'].query(Posts).filter(Posts.name == review_name,\
|
||||||
getattr(Posts,column_name).is_not(null())).all()
|
getattr(Posts,column_name).is_not(null())).all()
|
||||||
if len(postval) == 0 :
|
if len(postval) == 0 :
|
||||||
@@ -612,10 +612,10 @@ def database_update_row(review_name,column_name,column_value,update_style,output
|
|||||||
elif update_style == "toggletrue":
|
elif update_style == "toggletrue":
|
||||||
postval = outputs['postssession'].query(Posts).filter(Posts.name == review_name,\
|
postval = outputs['postssession'].query(Posts).filter(Posts.name == review_name,\
|
||||||
getattr(Posts,column_name).is_not(1)).all()
|
getattr(Posts,column_name).is_not(1)).all()
|
||||||
if len(postval) == 0 :
|
|
||||||
outputs['postssession'].query(Posts).filter(Posts.name == review_name).update\
|
outputs['postssession'].query(Posts).filter(Posts.name == review_name).update\
|
||||||
({column_name : column_value})
|
({column_name : "1"})
|
||||||
print (' Updated ',column_name, ' on value: ',postval[0].column_value, ' to: ',column_value)
|
print (' Updated ',column_name, ' on value: ',postval[0].column_value, ' to: ',\
|
||||||
|
column_value)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(" Not able to write to post data table to update ",review_name," ",column_name,"\
|
print(" Not able to write to post data table to update ",review_name," ",column_name,"\
|
||||||
to: ",column_value , type(error), error)
|
to: ",column_value , type(error), error)
|
||||||
|
|||||||
Reference in New Issue
Block a user