diff --git a/CHANGELOG.md b/CHANGELOG.md index 7049c2456..92be1bea0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixes - Fix test related to preventing coercion of boolean values (True, False) to numeric values (0, 1) in query results ([#93](https://github.com/dbt-labs/dbt-bigquery/issues/93)) +- Ignore errors of the lack of permissions in `list_relations_without_caching` ([#104](https://github.com/dbt-labs/dbt-bigquery/issues/104)) - Add a check in `get_table_options` to check that the table has a `partition_by` in the config. This will prevent BigQuery from throwing an error since non-partitioned tables cannot have `require_partition_filter` ([#107](https://github.com/dbt-labs/dbt-bigquery/issues/107)) - Ignore errors of the lack of permissions in `list_relations_without_caching` ([#104](https://github.com/dbt-labs/dbt-bigquery/issues/104)) @@ -16,6 +17,7 @@ This will prevent BigQuery from throwing an error since non-partitioned tables c - [@oliverrmaa](https://github.com/oliverrmaa)([#109](https://github.com/dbt-labs/dbt-bigquery/pull/109)) - [@yu-iskw](https://github.com/yu-iskw)([#108](https://github.com/dbt-labs/dbt-bigquery/pull/108)) + ## dbt-bigquery 1.0.0 (December 3, 2021) ## dbt-bigquery 1.0.0rc2 (November 24, 2021) diff --git a/tests/integration/bigquery_test/no-access-models/model_1.sql b/tests/integration/bigquery_test/no-access-models/model_1.sql new file mode 100644 index 000000000..044a7464b --- /dev/null +++ b/tests/integration/bigquery_test/no-access-models/model_1.sql @@ -0,0 +1,3 @@ +{{ config(project = env_var('BIGQUERY_TEST_NO_ACCESS_DATABASE')) }} + +select 1 as id diff --git a/tests/integration/bigquery_test/no-access-models/model_2.sql b/tests/integration/bigquery_test/no-access-models/model_2.sql new file mode 100644 index 000000000..26d9cae7b --- /dev/null +++ b/tests/integration/bigquery_test/no-access-models/model_2.sql @@ -0,0 +1 @@ +select 1 as id \ No newline at end of file diff --git a/tests/integration/bigquery_test/test_no_access.py b/tests/integration/bigquery_test/test_no_access.py new file mode 100644 index 000000000..67a9f1b24 --- /dev/null +++ b/tests/integration/bigquery_test/test_no_access.py @@ -0,0 +1,29 @@ +from tests.integration.base import DBTIntegrationTest, use_profile +import dbt.exceptions + + +class TestNoAccess(DBTIntegrationTest): + + @property + def schema(self): + return 'no_access_models' + + @property + def models(self): + return "no-access-models" + + @use_profile('bigquery') + def test_bigquery_no_access(self): + """tests error exceptions against project user doesn't have access to.""" + results = self.run_dbt(['run','--exclude','model_1']) + self.assertEqual(len(results), 1) + results = self.run_dbt(['run','--select','model_2']) + self.assertEqual(len(results), 1) + try: + results = self.run_dbt(['run','--select','model_1']) + except dbt.exceptions.DatabaseException: + # have to test against DatabaseException as run_dbt catches warehouse thorwn error and genreralizes it to dbt version. + is_false = True + self.assertTrue(is_false) + self.assertRaises(dbt.exceptions.DatabaseException) + \ No newline at end of file