I am using Postgres database and sqlalchemy core. I have below table
CREATE TABLE IF NOT EXISTS id_generation (id SERIAL PRIMARY KEY)
and I am trying to insert multiple values in the id column using below query. number_of_ids can be in multiple of 1000.
for _ in range(number_of_ids):
conn.execute('INSERT INTO id_generation VALUES (DEFAULT)')
I just want to know is there any other way to write this query using Sqlalchemy core. How we can optimize it ?