Open zerlok opened 2 years ago
I found a "cache lookup failed" related issue in sqlalchemy https://github.com/sqlalchemy/sqlalchemy/issues/6645 . Maybe the 1 described behavior is not a GINO's bug. But I'm not sure about the 2 behavior.
One more thing. I found that async sqlalchemy (with asyncpg driver) works as expected for me in 1 and 2 cases (full code in repo).
Dependencies:
asyncpg==0.25.0; python_full_version >= "3.6.0"
atomicwrites==1.4.0; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.4.0"
attrs==21.4.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
click==8.1.3; python_version >= "3.7"
colorama==0.4.4; python_version >= "3.7" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.7" and python_full_version >= "3.5.0" and platform_system == "Windows"
greenlet==1.1.2; python_version >= "3" and python_full_version < "3.0.0" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") or python_version >= "3" and (platform_machine == "aarch64" or platform_machine == "ppc64le" or platform_machine == "x86_64" or platform_machine == "amd64" or platform_machine == "AMD64" or platform_machine == "win32" or platform_machine == "WIN32") and (python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.6.0") and python_full_version >= "3.5.0"
iniconfig==1.1.1; python_version >= "3.7"
packaging==21.3; python_version >= "3.7"
pluggy==1.0.0; python_version >= "3.7"
py==1.11.0; python_version >= "3.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.7"
pyparsing==3.0.9; python_full_version >= "3.6.8" and python_version >= "3.7"
pytest-asyncio==0.18.3; python_version >= "3.7"
pytest==7.1.2; python_version >= "3.7"
sqlalchemy==1.4.36; (python_version >= "2.7" and python_full_version < "3.0.0") or (python_full_version >= "3.6.0")
tomli==2.0.1; python_version >= "3.7"
wait-for-it==2.2.1; python_version >= "3.7"
I see a newer version of sqlalchemy here: sqlalchemy==1.4.36
, so I tried to install this version, but the higher version of sqlalchemy is forbidden by gino constraint
$ poetry add "sqlalchemy^1.4.36"
Updating dependencies
Resolving dependencies... (0.3s)
SolverProblemError
Because gino (1.0.1) depends on SQLAlchemy (>=1.2.16,<1.4)
and no versions of gino match >1.0.1,<2.0.0, gino (>=1.0.1,<2.0.0) requires SQLAlchemy (>=1.2.16,<1.4).
So, because python-bug-reports depends on both gino (^1.0.1) and SQLAlchemy (^1.4.36), version solving failed.
I'm not 100% sure if sqlalchemy upgrade will solve the problem with enums, but I'd like to ask. What's the reason to deny a higher version of sqlalchemy?
P.S. I found the question on SO about 1 case (described in the first message). It looks like 1.4 sqlalchemy version upgrade won't totaly fix the problem. https://stackoverflow.com/questions/68000969/sqlalchemy-1-4-throws-internalservererror-cache-lookup-failed-for-type-3912040
UPD: found gino develop plans for future and integration with sqlalchemy here.
Describe the bug
I'm trying to use gino in postgres with simple model with enum column type. It seems like enum is not fully supported and it behaves really strange in several cases:
1) when using gino Enum type in
where
filters,asyncpg.exceptions.InternalServerError: cache lookup failed for type 16453
error occurs 2) when using postgresql Enum and runningdb.gino.create_all()
,asyncpg.exceptions.UndefinedObjectError: type "test-schema.enum1" does not exist
error occursTo Reproduce
The full example is in my repo: https://github.com/zerlok/python-bugs/tree/gino/enum-usage
Expected result
I want all my test runs to finish without described exceptions. See README: https://github.com/zerlok/python-bugs/tree/gino/enum-usage#troubles-with-gino-sqlalchemy-postgres-enum
Actual result
For 1 case
For 2 case
Environment (please complete the following information):
postgres:
11.10
Additional context
I described a full info in my repo (it was easier for my) and I provided the full environment (docker image and docker-compose) to reproduce this bug, look at my repo: https://github.com/zerlok/python-bugs/tree/gino/enum-usage.