Skip to content

Commit

Permalink
Create UpdateQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Jul 29, 2019
1 parent e3bf3b3 commit 0c63010
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,20 @@ def execute_query(self):
record.MOD_ID = "user" # These will need changing
self.session.add(record)
self.commit_changes()



class UpdateQuery(Query):

def __init__(self, table, row, new_values):
super().__init__(table)
self.row = row
self.new_values = new_values

def execute_query(self):
log.info(f" Updating row in {self.table}")
self.row.update_from_dict(self.new_values)
self.commit_changes()


def insert_row_into_table(row):
"""
Expand Down

0 comments on commit 0c63010

Please sign in to comment.