Skip to content

Implement a .get on asyncpg.Record #330

New issue

Have a question about this project? No Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “No Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? No Sign in to your account

Closed
modelmat opened this issue Jul 27, 2018 · 0 comments
Closed

Implement a .get on asyncpg.Record #330

modelmat opened this issue Jul 27, 2018 · 0 comments

Comments

@modelmat
Copy link

I have the following psuedocode:

record = database_pool.fetchval("some_sql") or {} # this is so I don't have to do `if result is None`
final = dict(record).get("column")

What I would like to see however, is a record.get function (similar to the dict.get())
The default argument should be used if a column is NULL, similar to dict.get()
This would allow for:

final = record.get("column", other_var)
elprans added a commit that referenced this issue Jul 28, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
elprans added a commit that referenced this issue Jul 28, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
elprans added a commit that referenced this issue Jul 28, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
elprans added a commit that referenced this issue Jul 28, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
elprans added a commit that referenced this issue Jul 28, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
elprans added a commit that referenced this issue Jul 30, 2018
`Record.get()` allows record objects to better masquerade as dicts.

Fixes: #330.
No Sign up for free to join this conversation on GitHub. Already have an account? No Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant