@@ -806,13 +806,12 @@ def get_dataset(
806
806
807
807
def get_iam_policy (
808
808
self ,
809
- table : Union [Table , TableReference ],
809
+ table : Union [Table , TableReference , TableListItem , str ],
810
810
requested_policy_version : int = 1 ,
811
811
retry : retries .Retry = DEFAULT_RETRY ,
812
812
timeout : float = DEFAULT_TIMEOUT ,
813
813
) -> Policy :
814
- if not isinstance (table , (Table , TableReference )):
815
- raise TypeError ("table must be a Table or TableReference" )
814
+ table = _table_arg_to_table_ref (table , default_project = self .project )
816
815
817
816
if requested_policy_version != 1 :
818
817
raise ValueError ("only IAM policy version 1 is supported" )
@@ -835,14 +834,13 @@ def get_iam_policy(
835
834
836
835
def set_iam_policy (
837
836
self ,
838
- table : Union [Table , TableReference ],
837
+ table : Union [Table , TableReference , TableListItem , str ],
839
838
policy : Policy ,
840
839
updateMask : str = None ,
841
840
retry : retries .Retry = DEFAULT_RETRY ,
842
841
timeout : float = DEFAULT_TIMEOUT ,
843
842
) -> Policy :
844
- if not isinstance (table , (Table , TableReference )):
845
- raise TypeError ("table must be a Table or TableReference" )
843
+ table = _table_arg_to_table_ref (table , default_project = self .project )
846
844
847
845
if not isinstance (policy , (Policy )):
848
846
raise TypeError ("policy must be a Policy" )
@@ -869,13 +867,12 @@ def set_iam_policy(
869
867
870
868
def test_iam_permissions (
871
869
self ,
872
- table : Union [Table , TableReference ],
870
+ table : Union [Table , TableReference , TableListItem , str ],
873
871
permissions : Sequence [str ],
874
872
retry : retries .Retry = DEFAULT_RETRY ,
875
873
timeout : float = DEFAULT_TIMEOUT ,
876
874
) -> Dict [str , Any ]:
877
- if not isinstance (table , (Table , TableReference )):
878
- raise TypeError ("table must be a Table or TableReference" )
875
+ table = _table_arg_to_table_ref (table , default_project = self .project )
879
876
880
877
body = {"permissions" : permissions }
881
878
@@ -982,7 +979,7 @@ def get_routine(
982
979
983
980
def get_table (
984
981
self ,
985
- table : Union [Table , TableReference , str ],
982
+ table : Union [Table , TableReference , TableListItem , str ],
986
983
retry : retries .Retry = DEFAULT_RETRY ,
987
984
timeout : float = DEFAULT_TIMEOUT ,
988
985
) -> Table :
@@ -992,6 +989,7 @@ def get_table(
992
989
table (Union[ \
993
990
google.cloud.bigquery.table.Table, \
994
991
google.cloud.bigquery.table.TableReference, \
992
+ google.cloud.bigquery.table.TableListItem, \
995
993
str, \
996
994
]):
997
995
A reference to the table to fetch from the BigQuery API.
@@ -1757,7 +1755,7 @@ def delete_routine(
1757
1755
1758
1756
def delete_table (
1759
1757
self ,
1760
- table : Union [Table , TableReference , str ],
1758
+ table : Union [Table , TableReference , TableListItem , str ],
1761
1759
retry : retries .Retry = DEFAULT_RETRY ,
1762
1760
timeout : float = DEFAULT_TIMEOUT ,
1763
1761
not_found_ok : bool = False ,
@@ -1771,6 +1769,7 @@ def delete_table(
1771
1769
table (Union[ \
1772
1770
google.cloud.bigquery.table.Table, \
1773
1771
google.cloud.bigquery.table.TableReference, \
1772
+ google.cloud.bigquery.table.TableListItem, \
1774
1773
str, \
1775
1774
]):
1776
1775
A reference to the table to delete. If a string is passed in,
@@ -2257,7 +2256,7 @@ def api_request(*args, **kwargs):
2257
2256
def load_table_from_uri (
2258
2257
self ,
2259
2258
source_uris : Union [str , Sequence [str ]],
2260
- destination : Union [Table , TableReference , str ],
2259
+ destination : Union [Table , TableReference , TableListItem , str ],
2261
2260
job_id : str = None ,
2262
2261
job_id_prefix : str = None ,
2263
2262
location : str = None ,
@@ -2278,6 +2277,7 @@ def load_table_from_uri(
2278
2277
destination (Union[ \
2279
2278
google.cloud.bigquery.table.Table, \
2280
2279
google.cloud.bigquery.table.TableReference, \
2280
+ google.cloud.bigquery.table.TableListItem, \
2281
2281
str, \
2282
2282
]):
2283
2283
Table into which data is to be loaded. If a string is passed
@@ -2339,7 +2339,7 @@ def load_table_from_uri(
2339
2339
def load_table_from_file (
2340
2340
self ,
2341
2341
file_obj : BinaryIO ,
2342
- destination : Union [Table , TableReference , str ],
2342
+ destination : Union [Table , TableReference , TableListItem , str ],
2343
2343
rewind : bool = False ,
2344
2344
size : int = None ,
2345
2345
num_retries : int = _DEFAULT_NUM_RETRIES ,
@@ -2360,6 +2360,7 @@ def load_table_from_file(
2360
2360
destination (Union[ \
2361
2361
google.cloud.bigquery.table.Table, \
2362
2362
google.cloud.bigquery.table.TableReference, \
2363
+ google.cloud.bigquery.table.TableListItem, \
2363
2364
str, \
2364
2365
]):
2365
2366
Table into which data is to be loaded. If a string is passed
@@ -2699,7 +2700,7 @@ def load_table_from_dataframe(
2699
2700
def load_table_from_json (
2700
2701
self ,
2701
2702
json_rows : Iterable [Dict [str , Any ]],
2702
- destination : Union [Table , TableReference , str ],
2703
+ destination : Union [Table , TableReference , TableListItem , str ],
2703
2704
num_retries : int = _DEFAULT_NUM_RETRIES ,
2704
2705
job_id : str = None ,
2705
2706
job_id_prefix : str = None ,
@@ -2733,6 +2734,7 @@ def load_table_from_json(
2733
2734
destination (Union[ \
2734
2735
google.cloud.bigquery.table.Table, \
2735
2736
google.cloud.bigquery.table.TableReference, \
2737
+ google.cloud.bigquery.table.TableListItem, \
2736
2738
str, \
2737
2739
]):
2738
2740
Table into which data is to be loaded. If a string is passed
@@ -2980,9 +2982,13 @@ def _do_multipart_upload(
2980
2982
def copy_table (
2981
2983
self ,
2982
2984
sources : Union [
2983
- Table , TableReference , str , Sequence [Union [Table , TableReference , str ]]
2985
+ Table ,
2986
+ TableReference ,
2987
+ TableListItem ,
2988
+ str ,
2989
+ Sequence [Union [Table , TableReference , TableListItem , str ]],
2984
2990
],
2985
- destination : Union [Table , TableReference , str ],
2991
+ destination : Union [Table , TableReference , TableListItem , str ],
2986
2992
job_id : str = None ,
2987
2993
job_id_prefix : str = None ,
2988
2994
location : str = None ,
@@ -3000,11 +3006,13 @@ def copy_table(
3000
3006
sources (Union[ \
3001
3007
google.cloud.bigquery.table.Table, \
3002
3008
google.cloud.bigquery.table.TableReference, \
3009
+ google.cloud.bigquery.table.TableListItem, \
3003
3010
str, \
3004
3011
Sequence[ \
3005
3012
Union[ \
3006
3013
google.cloud.bigquery.table.Table, \
3007
3014
google.cloud.bigquery.table.TableReference, \
3015
+ google.cloud.bigquery.table.TableListItem, \
3008
3016
str, \
3009
3017
] \
3010
3018
], \
@@ -3013,6 +3021,7 @@ def copy_table(
3013
3021
destination (Union[ \
3014
3022
google.cloud.bigquery.table.Table, \
3015
3023
google.cloud.bigquery.table.TableReference, \
3024
+ google.cloud.bigquery.table.TableListItem, \
3016
3025
str, \
3017
3026
]):
3018
3027
Table into which data is to be copied.
@@ -3084,7 +3093,7 @@ def copy_table(
3084
3093
3085
3094
def extract_table (
3086
3095
self ,
3087
- source : Union [Table , TableReference , Model , ModelReference , str ],
3096
+ source : Union [Table , TableReference , TableListItem , Model , ModelReference , str ],
3088
3097
destination_uris : Union [str , Sequence [str ]],
3089
3098
job_id : str = None ,
3090
3099
job_id_prefix : str = None ,
@@ -3104,6 +3113,7 @@ def extract_table(
3104
3113
source (Union[ \
3105
3114
google.cloud.bigquery.table.Table, \
3106
3115
google.cloud.bigquery.table.TableReference, \
3116
+ google.cloud.bigquery.table.TableListItem, \
3107
3117
google.cloud.bigquery.model.Model, \
3108
3118
google.cloud.bigquery.model.ModelReference, \
3109
3119
src, \
@@ -3465,7 +3475,7 @@ def insert_rows_from_dataframe(
3465
3475
3466
3476
def insert_rows_json (
3467
3477
self ,
3468
- table : Union [Table , TableReference , str ],
3478
+ table : Union [Table , TableReference , TableListItem , str ],
3469
3479
json_rows : Sequence [Dict ],
3470
3480
row_ids : Union [Iterable [str ], AutoRowIDs , None ] = AutoRowIDs .GENERATE_UUID ,
3471
3481
skip_invalid_rows : bool = None ,
@@ -3483,6 +3493,7 @@ def insert_rows_json(
3483
3493
table (Union[ \
3484
3494
google.cloud.bigquery.table.Table \
3485
3495
google.cloud.bigquery.table.TableReference, \
3496
+ google.cloud.bigquery.table.TableListItem, \
3486
3497
str \
3487
3498
]):
3488
3499
The destination table for the row data, or a reference to it.
@@ -3605,7 +3616,7 @@ def insert_rows_json(
3605
3616
3606
3617
def list_partitions (
3607
3618
self ,
3608
- table : Union [Table , TableReference , str ],
3619
+ table : Union [Table , TableReference , TableListItem , str ],
3609
3620
retry : retries .Retry = DEFAULT_RETRY ,
3610
3621
timeout : float = DEFAULT_TIMEOUT ,
3611
3622
) -> Sequence [str ]:
@@ -3615,6 +3626,7 @@ def list_partitions(
3615
3626
table (Union[ \
3616
3627
google.cloud.bigquery.table.Table, \
3617
3628
google.cloud.bigquery.table.TableReference, \
3629
+ google.cloud.bigquery.table.TableListItem, \
3618
3630
str, \
3619
3631
]):
3620
3632
The table or reference from which to get partition info
0 commit comments