diff --git a/ibis/backends/base/sql/alchemy/registry.py b/ibis/backends/base/sql/alchemy/registry.py index b1c12788c55b..af2bc39858cf 100644 --- a/ibis/backends/base/sql/alchemy/registry.py +++ b/ibis/backends/base/sql/alchemy/registry.py @@ -117,9 +117,11 @@ def get_col_or_deferred_col(sa_table, colname): where `table_set` is `sa_table` above. """ try: - out_expr = sa_table.c[colname] + col = sa_table.c[colname] except KeyError: out_expr = sa.column(colname) + else: + out_expr = sa_table.corresponding_column(col) return out_expr diff --git a/pyproject.toml b/pyproject.toml index ba6336d05b67..37876bdef16d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -198,6 +198,7 @@ filterwarnings = [ 'ignore:Dialect postgresql.psycopg2 will not make use of SQL compilation caching:', 'ignore:The URL\.__to_string__ method is deprecated:', "ignore:UserDefinedType .* will not produce a cache key because:", + "ignore:The SelectBase.c:", # this is coming from sqlalchemy 1.4, and indicates the bug we're tracking in #3526 'ignore:SELECT statement has a cartesian product between FROM element\(s\):', # ibis