-
Notifications
You must be signed in to change notification settings - Fork 46
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
Generate to a better default location with --file
option
#410
Comments
dbschema
by default with --file
option--file
option
We've had some discussion about this on Slack. @tailhook recommends an alternative default location for a single file:
The rub here is that we can't guarantee modules in the common prefix are importable. Maybe there is a way to test for this and drop in an |
--file
option--file
option
I'm a bit skeptical about adding a |
Another idea is to like just generate code into the standard output (when some non-default switch is turned on), and let the user decide where to put the file (and how to name it). This might've been discussed already, but as we're here ... 🤷♂️ |
Are you saying we already look for the common prefix, @fantix? When I generated using |
Oh sorry I mean after fixing this issue, we will be "trying our best to use the common prefix", and probably don't need to add the |
The impetus for this, in the event the context is helpful, was that @1st1 gave me feedback on the FastAPI example project that I shouldn't be importing a file from the root. I hadn't made the decision to do it that way consciously. I had just generated with All that to say, I'm not married to a particular fix for it if there is a better option than what's been proposed. |
If it's of any interest to you, what i do is store my .edgeql files in poetry run -m edgedb.codegen --dir ./myappname/db/ --file ./myappname/db/__init__.py \
&& poetry run ruff format ./myappname/db/__init__.py because i like being able to do from myappname import db
db.query_name(db_client, a=b, ...) |
The code generator currently generates to the project root by default with the
--file
option if no path is provided. Changing the default path todbschema
would provide consistency with the JS code generator and would make it easier for users to be consistent with language best practice.The text was updated successfully, but these errors were encountered: