Skip to content

Commit

Permalink
fix(sqlalchemy): ignore database when specified with temp=True
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud committed Aug 9, 2023
1 parent 0ee68e2 commit 04461d5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions ibis/backends/base/sql/alchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,15 @@ def create_table(
self._run_pre_execute_hooks(obj)

table = self._table_from_schema(
name, schema, database=database or self.current_database, temp=temp
name,
schema,
# most databases don't allow temporary tables in a specific
# database so let the backend decide
#
# the ones that do (e.g., snowflake) should implement their own
# `create_table`
database=None if temp else (database or self.current_database),
temp=temp,
)

if has_expr:
Expand Down Expand Up @@ -409,7 +417,6 @@ def _table_from_schema(
*columns,
prefixes=[self._temporary_prefix] if temp else [],
quote=self.compiler.translator_class._quote_table_names,
schema=database,
**kwargs,
)

Expand Down

0 comments on commit 04461d5

Please sign in to comment.