@@ -116,7 +116,6 @@ def configuration_schema(cls):
116116 'location' : {
117117 "type" : "string" ,
118118 "title" : "Processing Location" ,
119- "default" : "US" ,
120119 },
121120 'loadSchema' : {
122121 "type" : "boolean" ,
@@ -154,15 +153,17 @@ def _get_project_id(self):
154153 return self .configuration ["projectId" ]
155154
156155 def _get_location (self ):
157- return self .configuration .get ("location" , "US" )
156+ return self .configuration .get ("location" )
158157
159158 def _get_total_bytes_processed (self , jobs , query ):
160159 job_data = {
161160 "query" : query ,
162161 "dryRun" : True ,
163- 'location' : self ._get_location ()
164162 }
165163
164+ if self ._get_location ():
165+ job_data ['location' ] = self ._get_location ()
166+
166167 if self .configuration .get ('useStandardSql' , False ):
167168 job_data ['useLegacySql' ] = False
168169
@@ -178,9 +179,11 @@ def _get_query_result(self, jobs, query):
178179 }
179180 }
180181 }
181- job_data ['jobReference' ] = {
182+
183+ if self ._get_location ():
184+ job_data ['jobReference' ] = {
182185 'location' : self ._get_location ()
183- }
186+ }
184187
185188 if self .configuration .get ('useStandardSql' , False ):
186189 job_data ['configuration' ]['query' ]['useLegacySql' ] = False
@@ -207,10 +210,17 @@ def _get_query_result(self, jobs, query):
207210 rows .append (transform_row (row , query_reply ["schema" ]["fields" ]))
208211
209212 current_row += len (query_reply ['rows' ])
210- query_reply = jobs .getQueryResults (projectId = project_id ,
211- location = self ._get_location (),
212- jobId = query_reply ['jobReference' ]['jobId' ],
213- startIndex = current_row ).execute ()
213+
214+ query_result_request = {
215+ 'projectId' : project_id ,
216+ 'jobId' : query_reply ['jobReference' ]['jobId' ],
217+ 'startIndex' : current_row
218+ }
219+
220+ if self ._get_location ():
221+ query_result_request ['location' ] = self ._get_location ()
222+
223+ query_reply = jobs .getQueryResults (** query_result_request ).execute ()
214224
215225 columns = [{'name' : f ["name" ],
216226 'friendly_name' : f ["name" ],
0 commit comments