Skip to content

Commit

Permalink
Fixes to skip_entry
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed May 28, 2018
1 parent fff6371 commit 205c77b
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@

parameters, datapackage, res_iter = ingest()

db_table = parameters.pop('db-table')
engine = create_engine(os.environ['DPP_DB_ENGINE'])
if 'db-table' in parameters:
db_table = parameters.pop('db-table')
engine = create_engine(os.environ['DPP_DB_ENGINE'])
else:
db_table = None
engine = None

def skip_entry(id):
query = 'update {} set (__last_updated_at,__next_update_days)=(current_timestamp,60) where id={}'
.format(db_table, id)
logging.info('Skipping company %s', id)
logging.info('Query: %r', query)
engine.execute(query)
if None not in (db_table, engine):
query = 'update {} set (__last_updated_at,__next_update_days)=(current_timestamp,60) where id={}'.format(db_table, id)
logging.info('Skipping company %s', id)
logging.info('Query: %r', query)
engine.execute(query)

selectors = {
'DisplayCompanyPurpose': 'company_goal',
Expand Down

0 comments on commit 205c77b

Please sign in to comment.