Skip to content

Commit

Permalink
test(bigquery): make test non-strict xfail (#10081)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Sep 10, 2024
1 parent a20d194 commit a32e8e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
22 changes: 4 additions & 18 deletions ibis/backends/bigquery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,31 +181,17 @@ def _in_memory_table_exists(self, name: str) -> bool:
return True

def _finalize_memtable(self, name: str) -> None:
session_dataset = self._session_dataset
table_id = sg.table(
name,
db=session_dataset.dataset_id,
catalog=session_dataset.project,
quoted=False,
)
drop_sql_stmt = sge.Drop(kind="TABLE", this=table_id, exists=True)
self.raw_sql(drop_sql_stmt)
table_ref = bq.TableReference(self._session_dataset, name)
self.client.delete_table(table_ref, not_found_ok=True)

def _register_in_memory_table(self, op: ops.InMemoryTable) -> None:
session_dataset = self._session_dataset

table_id = sg.table(
op.name,
db=session_dataset.dataset_id,
catalog=session_dataset.project,
quoted=False,
).sql(dialect=self.name)
table_ref = bq.TableReference(self._session_dataset, op.name)

bq_schema = BigQuerySchema.from_ibis(op.schema)

load_job = self.client.load_table_from_dataframe(
op.data.to_frame(),
table_id,
table_ref,
job_config=bq.LoadJobConfig(
# fail if the table already exists and contains data
write_disposition=bq.WriteDisposition.WRITE_EMPTY,
Expand Down
3 changes: 3 additions & 0 deletions ibis/backends/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,9 @@ def test_insert_into_table_missing_columns(con, temp_table):
raises=AssertionError,
reason="can't execute SQL inside of a finalizer without breaking everything",
)
@pytest.mark.notyet(
["bigquery"], raises=AssertionError, reason="test is flaky", strict=False
)
def test_memtable_cleanup(con):
name = ibis.util.gen_name("temp_memtable")
t = ibis.memtable({"a": [1, 2, 3], "b": list("def")}, name=name)
Expand Down

0 comments on commit a32e8e5

Please sign in to comment.