From 2f8bc627678cbe6d705a214ae814ef1373a1c2c7 Mon Sep 17 00:00:00 2001 From: Phillip Cloud <417981+cpcloud@users.noreply.github.com> Date: Thu, 16 Nov 2023 06:04:02 -0500 Subject: [PATCH] test(bigquery): fix failing non-warning tests --- ibis/backends/bigquery/__init__.py | 12 ++---- .../bigquery/tests/system/test_client.py | 43 +++++-------------- 2 files changed, 14 insertions(+), 41 deletions(-) diff --git a/ibis/backends/bigquery/__init__.py b/ibis/backends/bigquery/__init__.py index 414d486a21d8..7c034d162836 100644 --- a/ibis/backends/bigquery/__init__.py +++ b/ibis/backends/bigquery/__init__.py @@ -23,6 +23,7 @@ import ibis.common.exceptions as com import ibis.expr.operations as ops import ibis.expr.types as ir +from ibis import util from ibis.backends.base import CanCreateSchema, Database from ibis.backends.base.sql import BaseSQLBackend from ibis.backends.bigquery.client import ( @@ -494,14 +495,9 @@ def table( self, name: str, database: str | None = None, schema: str | None = None ) -> ir.TableExpr: if database is not None and schema is None: - util.warn_deprecated( - "database", - instead=( - f"The {self.name} backend cannot return a table expression using only a `database` specifier. " - "Include a `schema` argument." - ), - as_of="7.1", - removed_in="8.0", + raise com.IbisInputError( + f"The {self.name} backend cannot return a table expression using only a " + "`database` specifier. Include a `schema` argument." ) table = sg.parse_one(name, into=sg.exp.Table, read=self.name) diff --git a/ibis/backends/bigquery/tests/system/test_client.py b/ibis/backends/bigquery/tests/system/test_client.py index aa2e5d1db4bc..3876d208b9f6 100644 --- a/ibis/backends/bigquery/tests/system/test_client.py +++ b/ibis/backends/bigquery/tests/system/test_client.py @@ -35,14 +35,8 @@ def test_list_tables(con): assert set(tables) == {"functional_alltypes", "functional_alltypes_parted"} -def test_current_database(con, dataset_id): - with pytest.warns(FutureWarning, match="data project"): - db = con.current_database - assert db == dataset_id - assert db == con.dataset_id - assert con.list_tables(schema=db, like="alltypes") == con.list_tables( - like="alltypes" - ) +def test_current_database(con): + assert con.current_database == con.billing_project def test_array_collect(struct_table): @@ -244,37 +238,20 @@ def test_exists_table_different_project(con): def test_multiple_project_queries(con, snapshot): - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - so = con.table("posts_questions", database="bigquery-public-data.stackoverflow") - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - trips = con.table("trips", database="nyc-tlc.yellow") + so = con.table( + "posts_questions", database="bigquery-public-data", schema="stackoverflow" + ) + trips = con.table("trips", database="nyc-tlc", schema="yellow") join = so.join(trips, so.tags == trips.rate_code)[[so.title]] result = join.compile() snapshot.assert_match(result, "out.sql") -def test_multiple_project_queries_database_api(con, snapshot): - stackoverflow = con.database("bigquery-public-data.stackoverflow") - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - posts_questions = stackoverflow.posts_questions - yellow = con.database("nyc-tlc.yellow") - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - trips = yellow.trips - predicate = posts_questions.tags == trips.rate_code - join = posts_questions.join(trips, predicate)[[posts_questions.title]] - result = join.compile() - snapshot.assert_match(result, "out.sql") - - def test_multiple_project_queries_execute(con): - stackoverflow = con.database("bigquery-public-data.stackoverflow") - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - posts_questions = stackoverflow.posts_questions - posts_questions = posts_questions.limit(5) - yellow = con.database("nyc-tlc.yellow") - with pytest.warns(FutureWarning, match="`database` is deprecated as of v7.1"): - trips = yellow.trips - trips = trips.limit(5) + posts_questions = con.table( + "posts_questions", database="bigquery-public-data", schema="stackoverflow" + ) + trips = con.table("trips", database="nyc-taxi", schema="yellow").limit(5) predicate = posts_questions.tags == trips.rate_code cols = [posts_questions.title] join = posts_questions.left_join(trips, predicate)[cols]