Skip to content

Commit

Permalink
fix: support for dbs with no seqs, fixes #515
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeeva committed Jul 12, 2024
1 parent 84fd866 commit a28f4c8
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pgbelt/util/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ async def load_sequences(pool: Pool, seqs: dict[str, int], logger: Logger) -> No
given a dict of sequence named mapped to values, set each sequence to the
matching value
"""

# If seqs is empty, we have nothing to do. Skip the operation.
if not seqs:
logger.info("No sequences to load. Skipping sequence loading.")
return

logger.info(f"Loading sequences {list(seqs.keys())}...")
sql_template = "SELECT pg_catalog.setval('{}', {}, true);"
sql = "\n".join([sql_template.format(k, v) for k, v in seqs.items()])
Expand Down

0 comments on commit a28f4c8

Please sign in to comment.