Closed draew6 closed 10 months ago
That was actually discussed internally @draew6 but it was never implemented because it was not yet requested but it could be something to be added.
What if you put an example of what to expect and we can add to the roadmap?
I dont know what to expect as I am new to this topic but maybe this can help you somehow: https://github.com/agronholm/sqlacodegen which can generate declarative tables, dataclasses and sqlmodels(which is sqlalchemy+pydantic too) and maybe somehow transform it to Edgy models?
Hmm, interesting actually. Let us see what we can do on our side. Is this blocking you? Is Edgy working ok for you so far?
@tarsil It's not blocking me. Actually I am at stage 0 and that's picking ORM and Edgy looks best in python ecosystem. But I also like drizzle and few others. Do not let it to change your priorities. Good luck with edgy ;)
@draew6 by all means no worries at all and we can consider that.
Those are actually great options too do you and of course I hope you stick with Edgy ahaah
A kind of inspectdb command would be really nice like in Django. If it was available I would jump into Esmerald/Edgy right away.
@rolandf the good news is that, that was already in the roadmap. Tomorrow I will be starting to have a look and development so soon this should be out 🙂
@rolandf currently running tests and it looks promising. The type of generated models will be of type edgy.ReflectModel (it's in the docs). This way you can do whatever you want after and this doesn't manage migrations (which is a safe side). The equivalent of the managed True of Django 🙂
I tried:
env/bin/edgy inspectdb --database sqlite:///database.sqlite
I expected that to inspect database.sqlite
Got the following error:
/dev/QtPython66$ env/bin/edgy inspectdb --database sqlite:///database.sqlite
2023-11-04 18:35:00.556 | INFO | edgy.cli.operations.inspectdb:inspect_db:103 - Registry
not found in the application. Using credentials...
Logging in without authentication.
Traceback (most recent call last):
File "env/bin/edgy", line 33, in
@rolandf the inspectdb is still under development. I was just telling you what is coming 🙂
@rolandf the inspectdb is still under development. I was just telling you what is coming 🙂
No problem, I was not sure if I tried it a bit too early or if I made a mistake in the way I called the command. I'm trying it with sqlite db. If you need a beta tester I'm available.
Well, it's too early because it's on a branch but I so appreciate the initial tests. I still need to add SQLite sincr the schema and connection string is parsed differently from the rest. At the moment edgy is napping stuff. Hopefully next week a fully working version will be out but the way you ran the command will be the way of doing it, at least for the current design. Thank you for the feedback
Also once I have a working version I will ask you to checkout it and test it @rolandf . Is that ok with you?
Cool, I save the command for later then. Yes, you are very welcome to reach out to me for testing. I used ChatGPT to convert the pyproject.toml file into a setup.py file so I can "pip install -e ." from the branch checkout.
Hmm interesting because I always use the pip install -e . With pyproject without any problem @rolandf
Also @rolandf i tend to have people like yourself involved in the development and testing process. Which is great to make sure everything is delivered properly. This is how the multi tenancy support came to be. Stay tuned and during the week you will have something to play around. Promise
@rolandf i have moved this conversation to https://github.com/tarsil/edgy/discussions/42
Is it possible to generate models from existing database without writing all models myself? Thanks