-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Table type needs to be visible even if Databases not installed #21
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/flortz/fastapi-crudrouter/b86eudb7c |
I can see how that is an issue but I think the proposed solution might also cause problems if SQLAlchemy is not installed. |
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.
This should fix the problems with SQLA and databases
Co-authored-by: Adam Watkins <32209255+awtkns@users.noreply.github.com>
Co-authored-by: Adam Watkins <32209255+awtkns@users.noreply.github.com>
Makes sense, thanks! Added the suggested changes. |
Great project! I'm happy to report I was able to drop it in along with https://github.com/tiangolo/pydantic-sqlalchemy and it plays nicely with the generated Pydantic models.
That said, I ran into an issue where I had to install
Databases
in my project to be able to import any code from your package, even though I don't care about the databases connector (just using SQLAlchemy).Importing
SQLAlchemyCRUDRouter
ends up looking at the overall packagefastapi_crudrouter
which ends up looking at thatfrom .core import...
etc. etc. until it hitsDatabasesCRUDRouter
.Then, the try/except for importing
Databases
works as expected, but the import for theTable
type is also in that block. It's missing, but the rest of the code is still executing, and so it fails as not defined.This is the simplest/most direct fix, but you could also change the overall
from .core import ...
model if you want.Thanks again!