Skip to content

Commit

Permalink
fix(duckdb): ensure that already quoted identifiers are not erased
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored and gforsyth committed Dec 8, 2023
1 parent 7bf8e84 commit 45ee391
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ibis/backends/base/sql/alchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,7 +992,10 @@ def _get_table_identifier(self, *, name, namespace):
catalog=db,
quoted=self.compiler.translator_class._quote_table_names,
).transform(
lambda node: node.__class__(this=node.this, quoted=True)
lambda node: node.__class__(
this=node.this,
quoted=node.quoted or self.compiler.translator_class._quote_table_names,
)
if isinstance(node, sg.exp.Identifier)
else node
)
Expand Down
5 changes: 4 additions & 1 deletion ibis/backends/base/sql/alchemy/query_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def _format_table(self, op):
)
dialect = translator._dialect_name
result.fullname = sg.table(
name, db=namespace.schema, catalog=namespace.database
name,
db=namespace.schema,
catalog=namespace.database,
quoted=translator._quote_table_names,
).sql(dialect=_SQLALCHEMY_TO_SQLGLOT_DIALECT.get(dialect, dialect))
elif isinstance(op, ops.SQLQueryResult):
columns = translator._schema_to_sqlalchemy_columns(op.schema)
Expand Down

0 comments on commit 45ee391

Please sign in to comment.