@@ -1080,6 +1080,8 @@ def __init__(
1080
1080
self ,
1081
1081
arraysize = 5000 ,
1082
1082
credentials_path = None ,
1083
+ project_id = None ,
1084
+ job_project_id = None ,
1083
1085
location = None ,
1084
1086
credentials_info = None ,
1085
1087
credentials_base64 = None ,
@@ -1092,6 +1094,8 @@ def __init__(
1092
1094
self .credentials_path = credentials_path
1093
1095
self .credentials_info = credentials_info
1094
1096
self .credentials_base64 = credentials_base64
1097
+ self .project_id = project_id
1098
+ self .job_project_id = job_project_id
1095
1099
self .location = location
1096
1100
self .identifier_preparer = self .preparer (self )
1097
1101
self .dataset_id = None
@@ -1152,6 +1156,9 @@ def create_connect_args(self, url):
1152
1156
self ._add_default_dataset_to_job_config (
1153
1157
default_query_job_config , project_id , dataset_id
1154
1158
)
1159
+ self .project_id = project_id
1160
+ if self .job_project_id is None :
1161
+ self .job_project_id = project_id
1155
1162
1156
1163
if user_supplied_client :
1157
1164
# The user is expected to supply a client with
@@ -1162,7 +1169,7 @@ def create_connect_args(self, url):
1162
1169
credentials_path = self .credentials_path ,
1163
1170
credentials_info = self .credentials_info ,
1164
1171
credentials_base64 = self .credentials_base64 ,
1165
- project_id = project_id ,
1172
+ project_id = self . job_project_id ,
1166
1173
location = self .location ,
1167
1174
default_query_job_config = default_query_job_config ,
1168
1175
)
@@ -1177,7 +1184,7 @@ def _get_table_or_view_names(self, connection, item_types, schema=None):
1177
1184
)
1178
1185
1179
1186
client = connection .connection ._client
1180
- datasets = client .list_datasets ()
1187
+ datasets = client .list_datasets (self . project_id )
1181
1188
1182
1189
result = []
1183
1190
for dataset in datasets :
@@ -1278,7 +1285,7 @@ def _get_table(self, connection, table_name, schema=None):
1278
1285
1279
1286
client = connection .connection ._client
1280
1287
1281
- table_ref = self ._table_reference (schema , table_name , client . project )
1288
+ table_ref = self ._table_reference (schema , table_name , self . project_id )
1282
1289
try :
1283
1290
table = client .get_table (table_ref )
1284
1291
except NotFound :
@@ -1332,7 +1339,7 @@ def get_schema_names(self, connection, **kw):
1332
1339
if isinstance (connection , Engine ):
1333
1340
connection = connection .connect ()
1334
1341
1335
- datasets = connection .connection ._client .list_datasets ()
1342
+ datasets = connection .connection ._client .list_datasets (self . project_id )
1336
1343
return [d .dataset_id for d in datasets ]
1337
1344
1338
1345
def get_table_names (self , connection , schema = None , ** kw ):
0 commit comments