GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — use execute_many from backends directly by Mng-dev-ai · Pull Request #468 · encode/databases
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
Conversation
|
|
@aminalaee Any updates? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| queries = [self._build_query(query, values_set) for values_set in values] | ||
| async with self._query_lock: | ||
| await self._connection.execute_many(queries) | ||
| await self._connection.execute_many(queries, values) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Should we avoid building the queries here if you're going to compile them later?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it's been a long time since I wrote this PR, but I think we still need to convert the query to ClauseElement and bind params, but maybe we don't need list comprehension here, so maybe something like that is sufficient
async def execute_many(
self, query: typing.Union[ClauseElement, str], values: list
) -> None:
query = self._build_query(query,values[0])
async with self._query_lock:
await self._connection.execute_many(query, values)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Hm interesting. I'm not sure myself, just wanted to check if you had considered it.
Thanks for chiming in on this after the delay. If you're interested in working on it again I can review and release it. Did you confirm this works and improves performance as expected?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I can work on it tmr for a few.
it should improve the performance but i didn't make any benchmarks tbh
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| async def execute_many( | ||
| self, queries: typing.List[ClauseElement], values: typing.List[dict] | ||
| ) -> None: |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I presume this it not a breaking change for users because this is an internal method and values is always provided by us in the public method?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand what you mean here, but I think users are only supposed to use execute_many from the core file, not from any of the backends
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Yep that's the question — I want to gauge if changing this function signature is a breaking change.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
yea I don't think it should break anything
Sorry, something went wrong.
There was an error while loading. Please reload this page.
At least 1 approving review is required to merge this pull request.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Inserting to database using execute_many much slower than using fetch_all
There was an error while loading. Please reload this page.