Skip to content

Commit

Permalink
Add returning to update_command (#35)
Browse files Browse the repository at this point in the history
* Add returning to update_command

* remove bracket
  • Loading branch information
cymed authored Aug 16, 2024
1 parent 265151e commit 5d4349d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pirogue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ def update_command(
columns_at_end: list = [],
prefix: str = None,
where_clause: str = None,
returning: str = None,
indent: int = 2,
inner_defaults: dict = {},
) -> str:
Expand Down Expand Up @@ -367,6 +368,8 @@ def update_command(
add a prefix to the columns (do not applied to remapped columns)
where_clause
can be manually specified
returning
returning command
indent
add an indent in front
inner_defaults
Expand Down Expand Up @@ -440,7 +443,8 @@ def value(col):

return """UPDATE {s}.{t}{a} SET
{indent} {cols}
{indent} WHERE {where_clause};""".format(
{indent} WHERE {where_clause}
{indent} {returning};""".format(
indent=indent * " ",
s=table_schema,
t=table_name,
Expand Down Expand Up @@ -469,6 +473,7 @@ def value(col):
),
),
),
returning=f" RETURNING {returning}" if returning else "",
)


Expand Down

0 comments on commit 5d4349d

Please sign in to comment.