-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Convert simple_select_one_txn and simple_select_one to return tuples. #16612
Conversation
c4b714e
to
2ffd6c0
Compare
retcols=( | ||
"transaction_id", | ||
"origin", | ||
"ts", | ||
"response_code", | ||
"response_json", | ||
"has_been_referenced", | ||
), | ||
retcols=("response_code", "response_json"), |
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.
Nice!
Optional[Tuple[bool, str, bool]], | ||
await self.db_pool.simple_select_one( |
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 this going to give us integers on sqlite rather than bools?
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.
Also: the boolean fieldsall three fields seem to be nullable in the DB. Sorry if there is already an issue for this.
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.
Filed #16614.
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 this going to give us integers on sqlite rather than bools?
Luckily in this case the we can just do bool(...)
to handle both ints and nulls. Turns out we don't ever use the creator, so I dropped it from the response.
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.
No other nitpicks!
4686cd0
to
9fe2ec5
Compare
Rebased after merge of #16611. |
This is the last simple_* API that automatically creates dictionaries of the provided columns.
The vast majority of the time we return only a couple of columns and immediately unpack the dictionary. This is wasteful and a continuation of #16431.
Builds on #16611.