Python: Eliminate runtime package and use sqlalchemy#939
Merged
kyleconroy merged 3 commits intosqlc-dev:masterfrom Mar 16, 2021
Merged
Python: Eliminate runtime package and use sqlalchemy#939kyleconroy merged 3 commits intosqlc-dev:masterfrom
kyleconroy merged 3 commits intosqlc-dev:masterfrom
Conversation
kyleconroy
requested changes
Mar 11, 2021
Collaborator
kyleconroy
left a comment
There was a problem hiding this comment.
Really excited about this! Let me know if you have any questions about my comments.
kyleconroy
requested changes
Mar 16, 2021
Collaborator
kyleconroy
left a comment
There was a problem hiding this comment.
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.
added 3 commits
March 16, 2021 09:36
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
Contributor
Author
|
Github actions was having issues yesterday, which caused the tests to fail. I've pushed the rebased commits which triggered a new test run. |
kyleconroy
approved these changes
Mar 16, 2021
victoraugustolls
pushed a commit
to Streppel/sqlc
that referenced
this pull request
May 6, 2021
* 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
$1is replaced with:p1instead 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.