edgedb / edgedb-examples

EdgeDB example projects for different stacks
61 stars 21 forks source link

FastAPI CRUD name 'uuid' is not defined #106

Open Diwas2055 opened 1 year ago

Diwas2055 commented 1 year ago

File "/home/user/Desktop/edgeb_fastapiCrud/app/main.py", line 9, in from app import events, users File "/home/user/Desktop/edgeb_fastapiCrud/app/events.py", line 33, in @router.get("/events")


raise PydanticUndefinedAnnotation.from_name_error(e) from e pydantic.errors.PydanticUndefinedAnnotation: name 'uuid' is not defined

For further information visit https://errors.pydantic.dev/2.0.3/u/undefined-annotation

raddevon commented 1 year ago

Thank you for reporting this! It seems to be an issue between FastAPI and Pydantic that is breaking the project. We're looking into it…

raddevon commented 1 year ago

The issue seems to be that FastAPI compatibility with Pydantic V2 is not quite there yet. If you force reinstall V1 of Pydantic, that should get you up and running with the example while FastAPI gets it sorted out. We are working on filing a bug with them, but they've already acknowledged the problem in their discussion so they are probably already working to fix it.

Here's the command to force install the older version of Pydantic with pip:

pip install --force-reinstall -v "pydantic==1.10"