awtkns / fastapi-crudrouter

A dynamic FastAPI router that automatically creates CRUD routes for your models
https://fastapi-crudrouter.awtkns.com
MIT License
1.37k stars 154 forks source link

fast-apicrudrouter not working on Python 3.8 #20

Closed chethanuk closed 3 years ago

chethanuk commented 3 years ago

fastapi_crudrouter is not working on Py3.8

Python 3.7.8 (default, Nov  3 2020, 14:38:34)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from sqlalchemy.orm import sessionmaker
>>> from fastapi_crudrouter import SQLAlchemyCRUDRouter
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/chethan/.pyenv/versions/3.7.8/lib/python3.7/site-packages/fastapi_crudrouter/__init__.py", line 1, in <module>
    from .core import MemoryCRUDRouter, SQLAlchemyCRUDRouter, DatabasesCRUDRouter
  File "/Users/chethan/.pyenv/versions/3.7.8/lib/python3.7/site-packages/fastapi_crudrouter/core/__init__.py", line 5, in <module>
    from .databases import DatabasesCRUDRouter
  File "/Users/chethan/.pyenv/versions/3.7.8/lib/python3.7/site-packages/fastapi_crudrouter/core/databases.py", line 16, in <module>
    class DatabasesCRUDRouter(CRUDGenerator):
  File "/Users/chethan/.pyenv/versions/3.7.8/lib/python3.7/site-packages/fastapi_crudrouter/core/databases.py", line 18, in DatabasesCRUDRouter
    def __init__(self, schema: BaseModel, table: Table, database: Database, *args, **kwargs):
NameError: name 'Table' is not defined

API Version:

crudfast pip list | grep "fastapi"
fastapi            0.63.0
fastapi-crudrouter 0.3.1
awtkns commented 3 years ago

Do you have sqlachemy installed? The 3.8 tests are passing so it could be implementation related.

Run pytest ============================= test session starts ============================== platform linux -- Python 3.8.6, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 rootdir: /home/runner/work/fastapi-crudrouter/fastapi-crudrouter collected 113 items

tests/test_base.py .. [ 1%] tests/test_custom_ids.py .................... [ 19%] tests/test_dependencies.py .. [ 21%] tests/test_exclude.py ........ [ 28%] tests/test_overloads.py .................. [ 44%] tests/test_router.py ................................. [ 73%] tests/test_two_routers.py .............................. [100%]

============================= 113 passed in 6.54s ==============================

awtkns commented 3 years ago

We have fixed this issue it should work now with the latest release O.3.2