You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by cr...@apache.org on 2016/05/20 15:32:10 UTC

[1/2] incubator-airflow git commit: [AIRFLOW-148] Use BQ connection project by default in view access

Repository: incubator-airflow
Updated Branches:
  refs/heads/master 5898de186 -> 8bf335bdf


[AIRFLOW-148] Use BQ connection project by default in view access

Updates the internals of the BigQuery view access tools to make the source and
destination projects optional, where both values will default to the project
specified in the connection if not explicitly provided.

This is technically a breaking change but I've searched the public codebase and
found no direct calls to this (I'll be updating some internal operators that use
it separately)


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/3b46e2de
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/3b46e2de
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/3b46e2de

Branch: refs/heads/master
Commit: 3b46e2dee911dde730315b6b4035fe1cb0d66fb1
Parents: 20a536c
Author: Eric Stern <er...@ericstern.com>
Authored: Thu May 19 13:26:51 2016 -0700
Committer: Eric Stern <er...@ericstern.com>
Committed: Thu May 19 14:07:48 2016 -0700

----------------------------------------------------------------------
 airflow/contrib/hooks/bigquery_hook.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/3b46e2de/airflow/contrib/hooks/bigquery_hook.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/hooks/bigquery_hook.py b/airflow/contrib/hooks/bigquery_hook.py
index e73bb4e..735fa15 100644
--- a/airflow/contrib/hooks/bigquery_hook.py
+++ b/airflow/contrib/hooks/bigquery_hook.py
@@ -538,28 +538,34 @@ class BigQueryBaseCursor(object):
                                                 body=table_resource).execute()
 
     def run_grant_dataset_view_access(self,
-                                      source_project,
                                       source_dataset,
-                                      view_project,
                                       view_dataset,
-                                      view_table):
+                                      view_table,
+                                      source_project = None,
+                                      view_project = None):
         """
         Grant authorized view access of a dataset to a view table.
         If this view has already been granted access to the dataset, do nothing.
         This method is not atomic.  Running it may clobber a simultaneous update.
-        :param source_project: the project of the source dataset
-        :type source_project: str
         :param source_dataset: the source dataset
         :type source_dataset: str
-        :param view_project: the project that the view is in
-        :type view_project: str
         :param view_dataset: the dataset that the view is in
         :type view_dataset: str
         :param view_table: the table of the view
         :type view_table: str
+        :param source_project: the project of the source dataset. If None,
+        self.project_id will be used.
+        :type source_project: str
+        :param view_project: the project that the view is in. If None,
+        self.project_id will be used.
+        :type view_project: str
         :return: the datasets resource of the source dataset.
         """
 
+        # Apply default values to projects
+        source_project = source_project if source_project else self.project_id
+        view_project = view_project if view_project else self.project_id
+
         # we don't want to clobber any existing accesses, so we have to get
         # info on the dataset before we can add view access
         source_dataset_resource = self.service.datasets().get(projectId=source_project,


[2/2] incubator-airflow git commit: Merge branch '1524'

Posted by cr...@apache.org.
Merge branch '1524'


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/8bf335bd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/8bf335bd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/8bf335bd

Branch: refs/heads/master
Commit: 8bf335bdf68b251188e09026833053d7d64e64dc
Parents: 5898de1 3b46e2d
Author: Chris Riccomini <ch...@wepay.com>
Authored: Fri May 20 08:31:53 2016 -0700
Committer: Chris Riccomini <ch...@wepay.com>
Committed: Fri May 20 08:31:53 2016 -0700

----------------------------------------------------------------------
 airflow/contrib/hooks/bigquery_hook.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------