-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Remove more usages of cursor_to_dict #16551
Conversation
After this there's < 10 usages remaining. |
c73d1d6
to
9937cdf
Compare
# We need to pass execute a dummy function to handle the txn's result otherwise | ||
# it tries to call fetchall() on it and fails because there's no result to fetch. | ||
await self.db_pool.execute( | ||
await self.db_pool.runInteraction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the point that we should use runInteraction
when we don't expect---or don't care---about the result set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and the only place where we used a decoder before was where we were trying to ignore the result set!?!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the point that we should use
runInteraction
when we don't expect---or don't care---about the result set?
execute(...)
automatically calls fetchall()
(or iterates the txn
if you use cursor_to_dict
. You could do hacky things like this to not iterate the txn
and just leave it, but...I think this is as clear.
and the only place where we used a decoder before was where we were trying to ignore the result set!?!
Or we passed cursor_to_dict
in many many places, which are all gone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
More of #16431, this targets a bunch of individual usages, but also targets the usages of
execute
which can take a callable to map the results. In actuality it always passescursor_to_dict
.This can be split further, but isn't too large and should be reviewable commit-by-commit.