Repository: dbt-labs/dbt-core

Issue:
Add `partitions` to bq AdapterSpecificConfigs
### Describe the feature
* Allow the user to define `partitions` in `dbt_project.yml`. This is a necessary config if the user wants to run incremental models with the `insert_overwrite` strategy for a static (user-defined) set of partitions
* Adding/overriding `partitions` in `dbt_project.yml` is the only way to adjust behavior for models imported from a package (e.g. Snowplow)

### Additional context
This is functionality we added in #2198, but forgot to add `partitions` to [`AdapterSpecificConfigs`](https://github.com/fishtown-analytics/dbt/blob/dev/octavius-catto/plugins/bigquery/dbt/adapters/bigquery/impl.py#L141) in `dbt-bigquery`

### Who will this benefit?
BigQuery users



Discussion:
Cool idea @jtcohen6 - let's do it! 
We should do this for 0.16.1, right?

Resolving patch:
diff --git a/plugins/bigquery/dbt/adapters/bigquery/impl.py b/plugins/bigquery/dbt/adapters/bigquery/impl.py
--- a/plugins/bigquery/dbt/adapters/bigquery/impl.py
+++ b/plugins/bigquery/dbt/adapters/bigquery/impl.py
@@ -138,8 +138,9 @@ class BigQueryAdapter(BaseAdapter):
     Column = BigQueryColumn
     ConnectionManager = BigQueryConnectionManager
 
-    AdapterSpecificConfigs = frozenset({"cluster_by", "partition_by",
-                                        "kms_key_name", "labels"})
+    AdapterSpecificConfigs = frozenset({
+        "cluster_by", "partition_by", "kms_key_name", "labels", "partitions"
+    })
 
     ###
     # Implementations of abstract methods


Test patch:
diff --git a/test/integration/022_bigquery_test/dp-models/confirmation_noconfig.sql b/test/integration/022_bigquery_test/dp-models/confirmation_noconfig.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/022_bigquery_test/dp-models/confirmation_noconfig.sql
@@ -0,0 +1,20 @@
+
+-- This model checks to confirm that each date partition was created correctly.
+-- Columns day_1, day_2, and day_3 should have a value of 1, and count_days should be 3
+
+with base as (
+
+  select
+    case when _PARTITIONTIME = '2018-01-01' then 1 else 0 end as day_1,
+    case when _PARTITIONTIME = '2018-01-02' then 1 else 0 end as day_2,
+    case when _PARTITIONTIME = '2018-01-03' then 1 else 0 end as day_3
+  from {{ ref('partitioned_noconfig') }}
+
+)
+
+select distinct
+  sum(day_1) over () as day_1,
+  sum(day_2) over () as day_2,
+  sum(day_3) over () as day_3,
+  count(*) over () as count_days
+from base
diff --git a/test/integration/022_bigquery_test/dp-models/partitioned_noconfig.sql b/test/integration/022_bigquery_test/dp-models/partitioned_noconfig.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/022_bigquery_test/dp-models/partitioned_noconfig.sql
@@ -0,0 +1,7 @@
+-- Hack to make sure our events models run first.
+-- In practice, these would be source data
+-- {{ ref('events_20180101') }}
+-- {{ ref('events_20180102') }}
+-- {{ ref('events_20180103') }}
+
+select * from `{{ this.schema }}`.`{{ date_sharded_table('events_') }}`
diff --git a/test/integration/022_bigquery_test/dp-models/schema.yml b/test/integration/022_bigquery_test/dp-models/schema.yml
--- a/test/integration/022_bigquery_test/dp-models/schema.yml
+++ b/test/integration/022_bigquery_test/dp-models/schema.yml
@@ -7,7 +7,7 @@ models:
     - not_null
     - unique
 - name: confirmation
-  columns:
+  columns: &conf_columns
   - name: cast(count_days as string)
     tests:
     - accepted_values:
@@ -28,3 +28,6 @@ models:
     - accepted_values:
         values:
         - 1
+
+- name: confirmation_noconfig
+  columns: *conf_columns
diff --git a/test/integration/022_bigquery_test/test_bigquery_date_partitioning.py b/test/integration/022_bigquery_test/test_bigquery_date_partitioning.py
--- a/test/integration/022_bigquery_test/test_bigquery_date_partitioning.py
+++ b/test/integration/022_bigquery_test/test_bigquery_date_partitioning.py
@@ -1,4 +1,6 @@
 from test.integration.base import DBTIntegrationTest, FakeArgs, use_profile
+import textwrap
+import yaml
 
 
 class TestBigqueryDatePartitioning(DBTIntegrationTest):
@@ -15,10 +17,24 @@ def models(self):
     def profile_config(self):
         return self.bigquery_profile()
 
+    @property
+    def project_config(self):
+        return yaml.safe_load(textwrap.dedent('''\
+        models:
+            test:
+                partitioned_noconfig:
+                    materialized: table
+                    partitions:
+                        - 20180101
+                        - 20180102
+                        - 20180103
+                    verbose: true
+        '''))
+
     @use_profile('bigquery')
     def test__bigquery_date_partitioning(self):
         results = self.run_dbt()
-        self.assertEqual(len(results), 6)
+        self.assertEqual(len(results), 8)
 
         test_results = self.run_dbt(['test'])