Skip to content

Commit

Permalink
Restart _id sequence after table truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
jguo144 committed Oct 4, 2024
1 parent c685bc8 commit b721575
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ckanext/xloader/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _clear_datastore_resource(resource_id):
engine = get_write_engine()
with engine.begin() as conn:
conn.execute("SET LOCAL lock_timeout = '5s'")
conn.execute('TRUNCATE TABLE "{}"'.format(resource_id))
conn.execute('TRUNCATE TABLE "{}" RESTART IDENTITY'.format(resource_id))


def load_csv(csv_filepath, resource_id, mimetype='text/csv', logger=None):
Expand Down

0 comments on commit b721575

Please # to comment.