Closed sander1234567890 closed 9 years ago
What Python version? What momoko version? Linux/Windows?
Actually, you can not expect rowcount
property to be updated in execute
method when in async mode - execute
method finishes even before the query is sent to the server.
I suggest you consult with psycopg2 guys how to hook on execution completion when implementing custom cursors in async mode.
On the other hand, you can extend momoko and add "done_callback" to future
it returns to do whatever you originally wanted to do.
Feel free to reopen if you think otherwise.
Zaar
Hi,
I have a custom cursorfactory based on the psycopg2 RealDictCursor extension. That all works fine both on psycopg2 as with momoko, except when i try to access the rowcount of a query from within the custom cursorfactory class itself.
It works when i use the cursorfactory with psycopg2, but when i use the same cursorfactory with momoko it always returns -1 from within the cursorfactory.
Example code and results are below
Sander
Test example returns this:
PSYCHOPG2
rows within cursorfactory TestCursor | 10, 10, 10 rows before fetch: 10 rows after fetch: 10 10
MOMOKO
rows within cursorfactory TestCursor | -1, -1, -1 rows before fetch: 10 rows after fetch: 10 10
Code: