databases
databases copied to clipboard
execute_many should not discard results
consider the following:
CREATE TABLE my_table
(
id BIGSERIAL,
item INTEGER
)
query = """
INSERT INTO
my_table (item)
VALUES (:item) RETURNING id
"""
values=[{'item':100, 'item':200}]
my_ids = database.execute_many(query=query,values=values)
I would want to get the id for each value.
https://github.com/encode/databases/blob/45519d7ea1183d8d1ce24de21836ccb7c2174039/databases/backends/postgres.py#L182
Did anything changed? For now using fetch_all instead of execute_all is working for me.
activity_query = models.activities.insert().values(activity_values).returning(models.activities.c.id)
result = await database.fetch_all(query=activity_query)
I'm new to this, but it seems that DBAPI defines executemany() to have undefined behavior when returning one or more result sets. Does execute_many() in databases comply with DBAPI?
+1