-
Notifications
You must be signed in to change notification settings - Fork 881
Python: Eliminate runtime package and use sqlalchemy #939
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
Conversation
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.
Really excited about this! Let me know if you have any questions about my comments.
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.
Not sure why the tests are failing. Looks like you need to rebase as well. I'll hold off merging anything until this is green and ready to be merged in.
The generated example code is edited just to demostrate potential improvements to the python codegen. The main changes are using sqlalchemy as the exection engine and using stdlib dataclasses instead of pydantic. This also eliminates the runtime package.
Generated python code now only depends on sqlalchemy. Query functions are now inside classes as well.
c84ac49
to
5f73dbd
Compare
Github actions was having issues yesterday, which caused the tests to fail. I've pushed the rebased commits which triggered a new test run. |
* Manually edit python example code The generated example code is edited just to demostrate potential improvements to the python codegen. The main changes are using sqlalchemy as the exection engine and using stdlib dataclasses instead of pydantic. This also eliminates the runtime package. * Remove leftover debug code in python tests * Python: implement new codegen Generated python code now only depends on sqlalchemy. Query functions are now inside classes as well.
Based on comments on my initial python codegen PR I've put together some potential changes to the generated python code.
I've marked this as a draft PR because I've only made manual edits to the authors example. Once we have a more solid idea of what the generated python code should look like I'll make the changes to the actual codegen code.
A quick overview of the changes:
$1
is replaced with:p1
instead of just%s
.Notes:
:
character is special to sqlalchemy. The codegen will need to replace:
with\\:
in queries. I don't think this will cause issues, but there's always the potential for edge-case issues with regex replaces on the queries.