Skip to content

Commit 8336483

Browse files
authored
fix(examples): ensure that examples work on mssql and avoid using overwrite (#10909)
1 parent c29d83a commit 8336483

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

ibis/backends/mssql/tests/test_client.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,17 +200,20 @@ def test_create_temp_table_from_obj(con):
200200

201201
t = con.create_table("team", obj, temp=True)
202202

203-
t2 = con.table("##team", database="tempdb.dbo")
204-
205-
assert t.to_pyarrow().equals(t2.to_pyarrow())
206-
207-
persisted_from_temp = con.create_table("fuhreal", t2)
203+
try:
204+
t2 = con.table("##team", database="tempdb.dbo")
208205

209-
assert "fuhreal" in con.list_tables()
206+
assert t.to_pyarrow().equals(t2.to_pyarrow())
210207

211-
assert persisted_from_temp.to_pyarrow().equals(t2.to_pyarrow())
208+
persisted_from_temp = con.create_table("fuhreal", t2)
212209

213-
con.drop_table("fuhreal")
210+
try:
211+
assert "fuhreal" in con.list_tables()
212+
assert persisted_from_temp.to_pyarrow().equals(t2.to_pyarrow())
213+
finally:
214+
con.drop_table("fuhreal")
215+
finally:
216+
con.drop_table("#team", force=True)
214217

215218

216219
@pytest.mark.parametrize("explicit_schema", [False, True])

ibis/backends/tests/test_examples.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pytest import param
55

66
import ibis
7+
from ibis.backends.tests.errors import PyODBCProgrammingError
78
from ibis.conftest import LINUX, MACOS, SANDBOXED
89

910
pytestmark = pytest.mark.examples
@@ -16,18 +17,7 @@
1617
reason="nix on linux cannot download duckdb extensions or data due to sandboxing",
1718
)
1819
@pytest.mark.notimpl(["pyspark", "exasol", "databricks"])
19-
@pytest.mark.notyet(
20-
[
21-
"clickhouse",
22-
"druid",
23-
"impala",
24-
"mssql",
25-
"trino",
26-
"risingwave",
27-
"datafusion",
28-
"athena",
29-
]
30-
)
20+
@pytest.mark.notyet(["druid", "impala", "trino", "risingwave", "datafusion", "athena"])
3121
@pytest.mark.parametrize(
3222
("example", "columns"),
3323
[
@@ -67,6 +57,7 @@
6757
"year",
6858
],
6959
id="has-null-integer-values",
60+
marks=pytest.mark.notyet(["mssql"], raises=PyODBCProgrammingError),
7061
),
7162
],
7263
)

ibis/examples/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def fetch(
8282
# backends support passing a `pyarrow.Table` to `create_table`
8383
# directly.
8484
obj = ibis.memtable(table)
85-
return backend.create_table(table_name, obj, temp=True, overwrite=True)
85+
return backend.create_table(table_name, obj, temp=True)
8686

8787

8888
_FETCH_DOCSTRING_TEMPLATE = """\

0 commit comments

Comments
 (0)