Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ibis/backends/mssql/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ def create_table(
sge.Drop(kind="TABLE", this=this, exists=True).sql(self.dialect)
)
old = raw_table.sql(self.dialect)
new = raw_this.sql(self.dialect)
new = raw_this.name
cur.execute(f"EXEC sp_rename '{old}', '{new}'")

if temp:
Expand Down
21 changes: 19 additions & 2 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1855,6 +1855,21 @@ def test_table_not_found(con):
con.table(gen_name("table_not_found"))


@pytest.mark.parametrize(
"overwrite",
[
param(
True,
marks=[
pytest.mark.notimpl(
["mysql", "singlestoredb", "risingwave"],
reason="Cross-database load fails with overwrite (needs investigation).",
)
],
),
False,
],
)
@pytest.mark.notimpl(
["flink"], raises=com.IbisError, reason="not yet implemented for Flink"
)
Expand All @@ -1863,7 +1878,7 @@ def test_table_not_found(con):
raises=AssertionError,
reason="Schema resolution issue with cross-database table loading in Materialize (needs investigation).",
)
def test_no_accidental_cross_database_table_load(con_create_database):
def test_no_accidental_cross_database_table_load(con_create_database, overwrite):
con = con_create_database

# Create an extra database
Expand All @@ -1874,7 +1889,9 @@ def test_no_accidental_cross_database_table_load(con_create_database):
table := gen_name("table"), schema=(sch1 := ibis.schema({"a": "int"}))
)

con.create_table(table, schema=ibis.schema({"b": "string"}), database=dbname)
con.create_table(
table, schema=ibis.schema({"b": "string"}), database=dbname, overwrite=overwrite
)

# Can grab table object from current db:
t = con.table(table)
Expand Down
Loading