Skip to content

Commit

Permalink
#49: Add refresh to inserted entities
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Sep 30, 2019
1 parent a3b9551 commit 4d81ab9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class CreateQuery(Query):
def __init__(self, table, row):
super().__init__(table)
self.row = row
self.inserted_row = None

def execute_query(self):
"""Determines if the row is a row object or dictionary then commits it to the table"""
Expand All @@ -100,7 +101,8 @@ def execute_query(self):
record.MOD_ID = "user" # These will need changing
self.session.add(record)
self.commit_changes()

self.session.refresh(record)
self.inserted_row = record

class UpdateQuery(Query):

Expand Down

0 comments on commit 4d81ab9

Please sign in to comment.