@@ -806,13 +806,12 @@ def get_dataset(
806806
807807def get_iam_policy (
808808self ,
809- table :Union [Table ,TableReference ],
809+ table :Union [Table ,TableReference , TableListItem , str ],
810810requested_policy_version :int = 1 ,
811811retry :retries .Retry = DEFAULT_RETRY ,
812812timeout :float = DEFAULT_TIMEOUT ,
813813 )-> 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 )
816815
817816if requested_policy_version != 1 :
818817raise ValueError ("only IAM policy version 1 is supported" )
@@ -835,14 +834,13 @@ def get_iam_policy(
835834
836835def set_iam_policy (
837836self ,
838- table :Union [Table ,TableReference ],
837+ table :Union [Table ,TableReference , TableListItem , str ],
839838policy :Policy ,
840839updateMask :str = None ,
841840retry :retries .Retry = DEFAULT_RETRY ,
842841timeout :float = DEFAULT_TIMEOUT ,
843842 )-> 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 )
846844
847845if not isinstance (policy , (Policy )):
848846raise TypeError ("policy must be a Policy" )
@@ -869,13 +867,12 @@ def set_iam_policy(
869867
870868def test_iam_permissions (
871869self ,
872- table :Union [Table ,TableReference ],
870+ table :Union [Table ,TableReference , TableListItem , str ],
873871permissions :Sequence [str ],
874872retry :retries .Retry = DEFAULT_RETRY ,
875873timeout :float = DEFAULT_TIMEOUT ,
876874 )-> 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 )
879876
880877body = {"permissions" :permissions }
881878
@@ -982,7 +979,7 @@ def get_routine(
982979
983980def get_table (
984981self ,
985- table :Union [Table ,TableReference ,str ],
982+ table :Union [Table ,TableReference ,TableListItem , str ],
986983retry :retries .Retry = DEFAULT_RETRY ,
987984timeout :float = DEFAULT_TIMEOUT ,
988985 )-> Table :
@@ -992,6 +989,7 @@ def get_table(
992989 table (Union[\
993990 google.cloud.bigquery.table.Table,\
994991 google.cloud.bigquery.table.TableReference,\
992+ google.cloud.bigquery.table.TableListItem,\
995993 str,\
996994 ]):
997995 A reference to the table to fetch from the BigQuery API.
@@ -1757,7 +1755,7 @@ def delete_routine(
17571755
17581756def delete_table (
17591757self ,
1760- table :Union [Table ,TableReference ,str ],
1758+ table :Union [Table ,TableReference ,TableListItem , str ],
17611759retry :retries .Retry = DEFAULT_RETRY ,
17621760timeout :float = DEFAULT_TIMEOUT ,
17631761not_found_ok :bool = False ,
@@ -1771,6 +1769,7 @@ def delete_table(
17711769 table (Union[\
17721770 google.cloud.bigquery.table.Table,\
17731771 google.cloud.bigquery.table.TableReference,\
1772+ google.cloud.bigquery.table.TableListItem,\
17741773 str,\
17751774 ]):
17761775 A reference to the table to delete. If a string is passed in,
@@ -2257,7 +2256,7 @@ def api_request(*args, **kwargs):
22572256def load_table_from_uri (
22582257self ,
22592258source_uris :Union [str ,Sequence [str ]],
2260- destination :Union [Table ,TableReference ,str ],
2259+ destination :Union [Table ,TableReference ,TableListItem , str ],
22612260job_id :str = None ,
22622261job_id_prefix :str = None ,
22632262location :str = None ,
@@ -2278,6 +2277,7 @@ def load_table_from_uri(
22782277 destination (Union[\
22792278 google.cloud.bigquery.table.Table,\
22802279 google.cloud.bigquery.table.TableReference,\
2280+ google.cloud.bigquery.table.TableListItem,\
22812281 str,\
22822282 ]):
22832283 Table into which data is to be loaded. If a string is passed
@@ -2339,7 +2339,7 @@ def load_table_from_uri(
23392339def load_table_from_file (
23402340self ,
23412341file_obj :BinaryIO ,
2342- destination :Union [Table ,TableReference ,str ],
2342+ destination :Union [Table ,TableReference ,TableListItem , str ],
23432343rewind :bool = False ,
23442344size :int = None ,
23452345num_retries :int = _DEFAULT_NUM_RETRIES ,
@@ -2360,6 +2360,7 @@ def load_table_from_file(
23602360 destination (Union[\
23612361 google.cloud.bigquery.table.Table,\
23622362 google.cloud.bigquery.table.TableReference,\
2363+ google.cloud.bigquery.table.TableListItem,\
23632364 str,\
23642365 ]):
23652366 Table into which data is to be loaded. If a string is passed
@@ -2699,7 +2700,7 @@ def load_table_from_dataframe(
26992700def load_table_from_json (
27002701self ,
27012702json_rows :Iterable [Dict [str ,Any ]],
2702- destination :Union [Table ,TableReference ,str ],
2703+ destination :Union [Table ,TableReference ,TableListItem , str ],
27032704num_retries :int = _DEFAULT_NUM_RETRIES ,
27042705job_id :str = None ,
27052706job_id_prefix :str = None ,
@@ -2733,6 +2734,7 @@ def load_table_from_json(
27332734 destination (Union[\
27342735 google.cloud.bigquery.table.Table,\
27352736 google.cloud.bigquery.table.TableReference,\
2737+ google.cloud.bigquery.table.TableListItem,\
27362738 str,\
27372739 ]):
27382740 Table into which data is to be loaded. If a string is passed
@@ -2980,9 +2982,13 @@ def _do_multipart_upload(
29802982def copy_table (
29812983self ,
29822984sources :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 ]],
29842990 ],
2985- destination :Union [Table ,TableReference ,str ],
2991+ destination :Union [Table ,TableReference ,TableListItem , str ],
29862992job_id :str = None ,
29872993job_id_prefix :str = None ,
29882994location :str = None ,
@@ -3000,11 +3006,13 @@ def copy_table(
30003006 sources (Union[\
30013007 google.cloud.bigquery.table.Table,\
30023008 google.cloud.bigquery.table.TableReference,\
3009+ google.cloud.bigquery.table.TableListItem,\
30033010 str,\
30043011 Sequence[\
30053012 Union[\
30063013 google.cloud.bigquery.table.Table,\
30073014 google.cloud.bigquery.table.TableReference,\
3015+ google.cloud.bigquery.table.TableListItem,\
30083016 str,\
30093017 ]\
30103018 ],\
@@ -3013,6 +3021,7 @@ def copy_table(
30133021 destination (Union[\
30143022 google.cloud.bigquery.table.Table,\
30153023 google.cloud.bigquery.table.TableReference,\
3024+ google.cloud.bigquery.table.TableListItem,\
30163025 str,\
30173026 ]):
30183027 Table into which data is to be copied.
@@ -3084,7 +3093,7 @@ def copy_table(
30843093
30853094def extract_table (
30863095self ,
3087- source :Union [Table ,TableReference ,Model ,ModelReference ,str ],
3096+ source :Union [Table ,TableReference ,TableListItem , Model ,ModelReference ,str ],
30883097destination_uris :Union [str ,Sequence [str ]],
30893098job_id :str = None ,
30903099job_id_prefix :str = None ,
@@ -3104,6 +3113,7 @@ def extract_table(
31043113 source (Union[\
31053114 google.cloud.bigquery.table.Table,\
31063115 google.cloud.bigquery.table.TableReference,\
3116+ google.cloud.bigquery.table.TableListItem,\
31073117 google.cloud.bigquery.model.Model,\
31083118 google.cloud.bigquery.model.ModelReference,\
31093119 src,\
@@ -3465,7 +3475,7 @@ def insert_rows_from_dataframe(
34653475
34663476def insert_rows_json (
34673477self ,
3468- table :Union [Table ,TableReference ,str ],
3478+ table :Union [Table ,TableReference ,TableListItem , str ],
34693479json_rows :Sequence [Dict ],
34703480row_ids :Union [Iterable [str ],AutoRowIDs ,None ]= AutoRowIDs .GENERATE_UUID ,
34713481skip_invalid_rows :bool = None ,
@@ -3483,6 +3493,7 @@ def insert_rows_json(
34833493 table (Union[\
34843494 google.cloud.bigquery.table.Table\
34853495 google.cloud.bigquery.table.TableReference,\
3496+ google.cloud.bigquery.table.TableListItem,\
34863497 str\
34873498 ]):
34883499 The destination table for the row data, or a reference to it.
@@ -3605,7 +3616,7 @@ def insert_rows_json(
36053616
36063617def list_partitions (
36073618self ,
3608- table :Union [Table ,TableReference ,str ],
3619+ table :Union [Table ,TableReference ,TableListItem , str ],
36093620retry :retries .Retry = DEFAULT_RETRY ,
36103621timeout :float = DEFAULT_TIMEOUT ,
36113622 )-> Sequence [str ]:
@@ -3615,6 +3626,7 @@ def list_partitions(
36153626 table (Union[\
36163627 google.cloud.bigquery.table.Table,\
36173628 google.cloud.bigquery.table.TableReference,\
3629+ google.cloud.bigquery.table.TableListItem,\
36183630 str,\
36193631 ]):
36203632 The table or reference from which to get partition info