Repository: dbt-labs/dbt-core

Issue:
include_policy vs. quote_policy in BigQueryRelation
### Describe the bug
It looks like there's a (possibly innocuous?) bug in the impl of `get_include_policy` inside of `BigQueryRelation`, where it's returning a cloned `Policy` based on the `relation.quote_policy`, instead of `relation.include_policy`.

### Steps To Reproduce
It would only occur if the quote policy was different from the include policy- perhaps that doesn't happen for BQ?

### Expected behavior
The modified include_policy should be based on the relation's include_policy, not it's quote_policy.

### Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [X] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)

### Additional context
Add any other context about the problem here.

include_policy vs. quote_policy in BigQueryRelation
### Describe the bug
It looks like there's a (possibly innocuous?) bug in the impl of `get_include_policy` inside of `BigQueryRelation`, where it's returning a cloned `Policy` based on the `relation.quote_policy`, instead of `relation.include_policy`.

### Steps To Reproduce
It would only occur if the quote policy was different from the include policy- perhaps that doesn't happen for BQ?

### Expected behavior
The modified include_policy should be based on the relation's include_policy, not it's quote_policy.

### Screenshots and log output
If applicable, add screenshots or log output to help explain your problem.

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [X] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)

### Additional context
Add any other context about the problem here.



Discussion:
The relevant line of code: https://github.com/fishtown-analytics/dbt/blob/0.15.latest/plugins/bigquery/dbt/adapters/bigquery/relation.py#L68
Thanks @jwills - this is definitely a bug - we'll fix this in the next dbt release :)
The relevant line of code: https://github.com/fishtown-analytics/dbt/blob/0.15.latest/plugins/bigquery/dbt/adapters/bigquery/relation.py#L68
Thanks @jwills - this is definitely a bug - we'll fix this in the next dbt release :)

Resolving patch:
diff --git a/plugins/bigquery/dbt/adapters/bigquery/relation.py b/plugins/bigquery/dbt/adapters/bigquery/relation.py
--- a/plugins/bigquery/dbt/adapters/bigquery/relation.py
+++ b/plugins/bigquery/dbt/adapters/bigquery/relation.py
@@ -65,7 +65,7 @@ def get_include_policy(cls, relation, information_schema_view):
         if information_schema_view == '__TABLES__':
             identifier = False
 
-        return relation.quote_policy.replace(
+        return relation.include_policy.replace(
             schema=schema,
             identifier=identifier,
         )


Test patch:
diff --git a/test/unit/test_bigquery_adapter.py b/test/unit/test_bigquery_adapter.py
--- a/test/unit/test_bigquery_adapter.py
+++ b/test/unit/test_bigquery_adapter.py
@@ -12,6 +12,7 @@
 from dbt.adapters.bigquery import BigQueryCredentials
 from dbt.adapters.bigquery import BigQueryAdapter
 from dbt.adapters.bigquery import BigQueryRelation
+from dbt.adapters.bigquery.relation import BigQueryInformationSchema
 from dbt.adapters.bigquery.connections import BigQueryConnectionManager
 from dbt.adapters.base.query_headers import MacroQueryStringSetter
 from dbt.clients import agate_helper
@@ -314,6 +315,60 @@ def test_invalid_relation(self):
             BigQueryRelation.from_dict(kwargs)
 
 
+class TestBigQueryInformationSchema(unittest.TestCase):
+    def setUp(self):
+        flags.STRICT_MODE = True
+
+    def test_replace(self):
+
+        kwargs = {
+            'type': None,
+            'path': {
+                'database': 'test-project',
+                'schema': 'test_schema',
+                'identifier': 'my_view'
+            },
+            # test for #2188
+            'quote_policy': {
+                'database': False
+            },
+            'include_policy': {
+                'database': True,
+                'schema': True,
+                'identifier': True,
+            }
+        }
+        relation = BigQueryRelation.from_dict(kwargs)
+        info_schema = relation.information_schema()
+
+        tables_schema = info_schema.replace(information_schema_view='__TABLES__')
+        assert tables_schema.information_schema_view == '__TABLES__'
+        assert tables_schema.include_policy.schema is True
+        assert tables_schema.include_policy.identifier is False
+        assert tables_schema.include_policy.database is True
+        assert tables_schema.quote_policy.schema is True
+        assert tables_schema.quote_policy.identifier is False
+        assert tables_schema.quote_policy.database is False
+
+        schemata_schema = info_schema.replace(information_schema_view='SCHEMATA')
+        assert schemata_schema.information_schema_view == 'SCHEMATA'
+        assert schemata_schema.include_policy.schema is False
+        assert schemata_schema.include_policy.identifier is True
+        assert schemata_schema.include_policy.database is True
+        assert schemata_schema.quote_policy.schema is True
+        assert schemata_schema.quote_policy.identifier is False
+        assert schemata_schema.quote_policy.database is False
+
+        other_schema = info_schema.replace(information_schema_view='SOMETHING_ELSE')
+        assert other_schema.information_schema_view == 'SOMETHING_ELSE'
+        assert other_schema.include_policy.schema is True
+        assert other_schema.include_policy.identifier is True
+        assert other_schema.include_policy.database is True
+        assert other_schema.quote_policy.schema is True
+        assert other_schema.quote_policy.identifier is False
+        assert other_schema.quote_policy.database is False
+
+
 class TestBigQueryConnectionManager(unittest.TestCase):
 
     def setUp(self):