-
Notifications
You must be signed in to change notification settings - Fork 44
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
Generating single file for each directory in the queries directory #411
Comments
Why is the default mode (one Python file per .edgeql file) disliked here?Consider the queries folder structure as follows:
When I generate a python for file each edgql file the queries folder shall look like this:
And let's say I need to use the queries/movies/delete_edgeql.py it needs to be imported as follows:
And in the same location if I have to import queries/hero/delete_edgeql.py it is going to conflict.
And it is not possible to make an import like:
Whereas single python file per folder in the queries folder works fine:
Here is how it works;
Alright, what if I rename the edgeql files with the prefix of folder names as follows:
This works and it is not as clean as one file per module:
This also works and again it is not clean as one file per module:
Indeed the following is much cleaner:
Every language has its own advantage and while we maintain consistency across different language implementations, most will appreciate if we allow the users to play the advantage of their preferred language. |
I have created a fork, which would allow this work flow to be used. It adds an optional command line argument called I haven't done much testing, but this helped me with being able to have edgeql queries in a submodule to a parent project, which was what I needed. |
As the project may grow complex generating a single file for each query is cumbersome to use them. And having all in one file for a large project is also cumbersome.
I want to propose the idea:
If the following is the
queries
folder structure:With an option to generate a python file for each directory under the
queries
directory, the generated file shall look like this:Automatically prefix the folder name before each method in the file generated.
I've modified the local installation of
edgedb-python
for my convenience of using it in a project and achieved the desired result, albeit I need to run the command for each folder under thequeries
folder manually.I've modified the
edgedb\codegen\generator.py
andedgedb\codegen\cli.py
. Added an option called--cwd-file
incli.py
and then for the option modified thegenerator.py
to get the desired result.I see this issue can be clubbed with #410
The text was updated successfully, but these errors were encountered: