CursorDebugWrapper should allow using iterators/generators for executemany().
|Reported by:||Vadim Fint||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.0|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||yes||Patch needs improvement:||yes|
executemany on cursors can have a little speedup on huge lists if developer sends iterators or generators as args. Thus, they will have no len. CursorDebugWrapper tries to determine length for only one reason: put a record about number of executed queries into connection.queries.
It's good idea probably to determine if args have no len -- dont put info about amount of executed queries into connection.queries.
Right now I can do connection.cursor().cursor.executemany(sql, iterator) for that purpose. I mean -- python db wrappers usually allow iterators in executemany's args. Another ugly way right now - catch TypeError and silently ignore. This is because django do len() after calling executemany on underlying cursor =). Non-pythonic, yeah?
Change History (9)
comment:1 Changed 8 years ago by
|Patch needs improvement:||unset|
comment:7 Changed 5 years ago by
|Patch needs improvement:||set|
|Triage Stage:||Design decision needed → Accepted|