Skip to content

Commit

Permalink
fix(sqlalchemy): use corresponding_column to prevent spurious cross j…
Browse files Browse the repository at this point in the history
…oins
  • Loading branch information
cpcloud committed Apr 5, 2022
1 parent 8dac3fe commit fdada21
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ibis/backends/base/sql/alchemy/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fdada21

Please sign in to comment.