New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “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? Sign in to your account
Add support for writing from dataclasses. #12
Comments
I'd like to see built-in support for this feature as well. Temporary work-around: queries.update_article(conn, **dataclasses.asdict(article)) |
The I don't want to break this library for you all, but I do want to understand your use of it more. I would also like to understand if Also, I'm opposed to this because as it stands Sorry for being that maintainer 😄 I swear I have the best intentions here. I am getting pretty close to wanting to make a major version bump that removes this API though. |
Thanks for taking a look at this issue.
That's a good point. One of the reasons that I prefer aiosql is that it does not enforce ORM on you. @xlevus' Currently,
That's it.
I can agree with that. A narrow scope means that the essential features can get full focus. Move all the nice-to-haves to other packages. I can see three ways forward:
My personal votes go to options 2 and 3. Either option will do for me.
You're doing good. :) Saying "no" is important! |
My suggestion goes beyond being an ORM, and my example is probably a dumbed-down example. I see it as a way of simplifying code. currently, if you have a 'complex' nested object that goes into the database, you need to write some code to flatten it. Which you can't attach to your aiosql object, because it's an instance so you can't subclass it. So maybe, I don't think I was necessarily wanting an ORM, but more a path for handling more complex cases, without building something 'over there'. |
@xlevus Thank you very much for expanding on the ask! Super helpful. |
I agree that it should not be done. |
Currently, there is support for reading database rows into dataclasses which significantly reduces the amount of boilerplate required. But the inverse is not the case.
e.g.
If the parameters supported dot notation, this could be simplified to
The text was updated successfully, but these errors were encountered: