Open ObsidianDestroyer opened 1 year ago
A temporary solution for every one who got the same (works for me) error which defined in above of env.py
(alembic generated file) :
import types
import functools
def patch_reflect_table(function: t.Callable | types.FunctionType):
_copy = types.FunctionType(
function.__code__,
function.__globals__,
name=function.__name__,
argdefs=function.__defaults__,
closure=function.__closure__
)
_copy = functools.update_wrapper(_copy, function)
def wrapper(inspector: Inspector, table: Table, redundant_arg: None) -> None:
return _copy(inspector, table)
return wrapper
comparators._reflect_table = patch_reflect_table(comparators._reflect_table)
Describe the bug So, I have created a model for my table in Clickhouse:
The
BaseModel
for my table models is defined like:With the models above i'm trying to run alembic with following command:
The result:
What I'm expected after going to source code :
The problem is placed in line 118 of file (clickhouse_sqlalchemy/alembic/comparators.py), thats true that is
_reflect_table
function takes only 2 arguments, but 3 given. Source file path: alembic/util/sqla_compat.pySo in file where
_reflect_table()
(clickhouse_sqlalchemy/alembic/comparators.py) function is using I'm just removed third argument and it's started working, i've got migration what I expected.To Reproduce Sorry, that I'm not giving a code to reproduce the problem, but as I think - I gave enough code and description of problem.
Expected behavior I was expected that migration will be created with a generated code which contains commands to create table by defined model.
Versions