Skip to content

Commit

Permalink
#49: Make create_row return the inserted row
Browse files Browse the repository at this point in the history
  • Loading branch information
keiranjprice101 committed Sep 30, 2019
1 parent 4d81ab9 commit 0be6159
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions common/database_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,16 @@ def insert_row_into_table(table, row):
create_query.execute_query()


def create_row_from_json(table, json):
def create_row_from_json(table, data):
"""
Given a json dictionary create a row in the table from it
:param table: the table for the row to be inserted into
:param json: the dictionary containing the values
:return: nothing atm
:param data: the dictionary containing the values
:return: The inserted row as a dictionary
"""
with CreateQuery(table, json) as create_query:
with CreateQuery(table, data) as create_query:
create_query.execute_query()
return create_query.inserted_row.to_dict()


def get_row_by_id(table, id):
Expand Down

0 comments on commit 0be6159

Please sign in to comment.