You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The paginate function from fastapi-pagination until v0.11 returned a tuple of SQLAlchemy ORM model instances, but since v0.12 it returns instances of sqlalchemy.engine.row.Row.
This breaks some unittests and causes a validation error in general_routes.get_schema_changes (and potentially others):
INFO: None:0 - "GET /changes/schema/foo?page=1&size=10 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 428, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
return await self.app(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi/applications.py", line 276, in __call__
await super().__call__(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/middleware/cors.py", line 83, in __call__
await self.app(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/routing.py", line 276, in handle
await self.app(scope, receive, send)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/routing.py", line 66, in app
response = await func(request)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi/routing.py", line 237, in app
raw_response = await run_endpoint_function(
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi/routing.py", line 165, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/starlette/concurrency.py", line 41, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/anyio/to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 807, in run
result = context.run(func, *args)
File "/home/andi/workspace/aimaas/backend/general_routes.py", line 215, in get_schema_changes
return get_recent_schema_changes(db=db, schema_id=schema.id, params=params)
File "/home/andi/workspace/aimaas/backend/traceability/schema.py", line 78, in get_recent_schema_changes
return paginate(q, params)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi_pagination/ext/sqlalchemy.py", line 203, in paginate
return exec_pagination(query, params, conn, transformer, additional_data, subquery_count, unique, async_=False)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi_pagination/ext/sqlalchemy.py", line 119, in exec_pagination
return create_page(
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi_pagination/api.py", line 123, in create_page
return _page_val.get().create(items, **kwargs)
File "/home/andi/virtualenvs/aimaas/lib/python3.10/site-packages/fastapi_pagination/default.py", line 66, in create
return cls(
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 25 validation errors for Page[ChangeRequestSchema]
items -> 0 -> created_at
field required (type=value_error.missing)
items -> 0 -> created_by
field required (type=value_error.missing)
items -> 0 -> status
field required (type=value_error.missing)
items -> 0 -> object_type
field required (type=value_error.missing)
items -> 0 -> change_type
field required (type=value_error.missing)
items -> 1 -> created_at
field required (type=value_error.missing)
items -> 1 -> created_by
field required (type=value_error.missing)
items -> 1 -> status
field required (type=value_error.missing)
items -> 1 -> object_type
field required (type=value_error.missing)
items -> 1 -> change_type
field required (type=value_error.missing)
items -> 2 -> created_at
field required (type=value_error.missing)
items -> 2 -> created_by
field required (type=value_error.missing)
items -> 2 -> status
field required (type=value_error.missing)
items -> 2 -> object_type
field required (type=value_error.missing)
items -> 2 -> change_type
field required (type=value_error.missing)
items -> 3 -> created_at
field required (type=value_error.missing)
items -> 3 -> created_by
field required (type=value_error.missing)
items -> 3 -> status
field required (type=value_error.missing)
items -> 3 -> object_type
field required (type=value_error.missing)
items -> 3 -> change_type
field required (type=value_error.missing)
items -> 4 -> created_at
field required (type=value_error.missing)
items -> 4 -> created_by
field required (type=value_error.missing)
items -> 4 -> status
field required (type=value_error.missing)
items -> 4 -> object_type
field required (type=value_error.missing)
items -> 4 -> change_type
field required (type=value_error.missing)
The constraint was introduced in #74 due to pydantic/pydantic#4131. The fix for pydantic has been
released and the constraint is now superfluous.
This version constraint implicitly limited `fastapi-pagination` to v0.9.3, which now also gets
updated (to v0.11.4). However, it cannot be upgraded to the latest v0.12 series, due to #146.
The
paginate
function from fastapi-pagination until v0.11 returned a tuple of SQLAlchemy ORM model instances, but since v0.12 it returns instances ofsqlalchemy.engine.row.Row
.This breaks some unittests and causes a validation error in
general_routes.get_schema_changes
(and potentially others):Maybe, this should be reported as an issue to fastapi-pagination?
Maybe, this is related to an incomplete support for SQLAlchemy v2? (See #119)
The text was updated successfully, but these errors were encountered: