Skip to content
Closed
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
1 change: 0 additions & 1 deletion ibis/backends/duckdb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,7 +1781,6 @@ def _get_temp_view_definition(self, name: str, definition: str) -> str:
this=sg.to_identifier(name, quoted=self.compiler.quoted),
kind="VIEW",
expression=definition,
replace=True,
properties=sge.Properties(expressions=[sge.TemporaryProperty()]),
)

Expand Down
17 changes: 17 additions & 0 deletions ibis/backends/duckdb/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import pandas as pd
import pandas.testing as tm
import pyarrow as pa
import pyarrow.parquet as pq
import pytest
from packaging.version import parse as parse_version
from pytest import param
Expand Down Expand Up @@ -223,6 +224,22 @@ def test_read_sqlite(con, tmp_path):
assert ft.count().execute()


def test_read_does_not_replace_existing_name(tmp_path):
con = ibis.duckdb.connect()
first = tmp_path / "first.parquet"
second = tmp_path / "second.parquet"
pq.write_table(pa.table({"a": [1, 2]}), first)
pq.write_table(pa.table({"b": ["x"]}), second)

t = con.read_parquet(first, table_name="t")

with pytest.raises(duckdb.CatalogException, match="already exists"):
con.read_parquet(second, table_name="t")

assert t.columns == ("a",)
assert t.count().execute() == 2


def test_read_sqlite_no_table_name(con, tmp_path):
path = tmp_path / "test.db"

Expand Down
Loading