8000 Database.query() rows as AttrDict via AttrDictRowFactory by pydanny · Pull Request #13 · AnswerDotAI/apswutils · GitHub
[go: up one dir, main page]

Skip to content

Database.query() rows as AttrDict via AttrDictRowFactory#13

Closed
pydanny wants to merge 2 commits intomainfrom
query-row-attrdict
Closed

Database.query() rows as AttrDict via AttrDictRowFactory#13
pydanny wants to merge 2 commits intomainfrom
query-row-attrdict

Conversation

@pydanny
Copy link
Contributor
@pydanny pydanny commented Dec 25, 2024

Adds new row_tracer called AttrDictRowFactory that returns results as an AttrDict instead of a dict.

Benefits of this approach:

  • Dot notation is a little less typing that bracket notation
  • Equals dict so we aren't breaking things downstream
  • Doesn't use code-by-exception

@pydanny pydanny added the enhancement New feature or request label Dec 25, 2024
@pydanny pydanny marked this pull request as draft December 25, 2024 13:12
@pydanny pydanny marked this pull request as ready for review December 25, 2024 13:37
@pydanny pydanny changed the title Database.query() rows as AttrDict Database.query() rows as AttrDict via AttrDictRowFactory Dec 25, 2024
@jph00
Copy link
Contributor
jph00 commented Dec 25, 2024

I like this functionality, but maybe it would be more compelling if it was in a separate apswutils-ext (or something) lib? i.e. show how to extend apswutils with new libs.

Also, that would allow us to remove the dep on fastcore, which currently isn't used (except as a dev requirement in index.ipynb. which afaict could be easily removed.

wdyt?

@pydanny
Copy link
Contributor Author
pydanny commented Dec 26, 2024

That sounds really good, thanks for the catch on dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0