@@ -122,7 +122,7 @@ def create_bq_table(table_id, partition_col, partition_type, schema, bq_client,
122122 )
123123 )
124124
125- def create_bq_table_from_file (file , table_id , field_delimiter , partition_col , partition_type , schema , bq_client , partition_expiration = None , ignore_unknown_values = False ):
125+ def create_bq_table_from_file (file , table_id , field_delimiter , partition_col , partition_type , schema , bq_client , partition_expiration = None , ignore_unknown_values = False , labels = {} ):
126126 """
127127 Create a bigquery table from a local csv file
128128
@@ -143,7 +143,8 @@ def create_bq_table_from_file(file, table_id, field_delimiter, partition_col, pa
143143 skip_leading_rows = 1 , schema = schema ,
144144 write_disposition = bigquery .job .WriteDisposition .WRITE_APPEND ,
145145 field_delimiter = field_delimiter ,
146- ignore_unknown_values = ignore_unknown_values
146+ ignore_unknown_values = ignore_unknown_values ,
147+ labels = labels
147148 )
148149
149150 if partition_col :
@@ -175,7 +176,7 @@ def create_bq_table_from_file(file, table_id, field_delimiter, partition_col, pa
175176 )
176177
177178
178- def create_bq_table_from_file_json (table_id , schema , bq_client , partition_col = None , file = None , uri = None , partition_expiration = None , ignore_unknown_values = True ):
179+ def create_bq_table_from_file_json (table_id , schema , bq_client , partition_col = None , file = None , uri = None , partition_expiration = None , ignore_unknown_values = True , labels = {} ):
179180 """
180181 Create a bigquery table from a local csv file
181182
@@ -194,7 +195,8 @@ def create_bq_table_from_file_json(table_id, schema, bq_client, partition_col=No
194195 source_format = bigquery .SourceFormat .NEWLINE_DELIMITED_JSON ,
195196 schema = schema ,
196197 write_disposition = bigquery .job .WriteDisposition .WRITE_APPEND ,
197- ignore_unknown_values = ignore_unknown_values
198+ ignore_unknown_values = ignore_unknown_values ,
199+ labels = labels
198200 )
199201
200202 if partition_col :
@@ -405,7 +407,8 @@ def append_rows_bq_json(rows_to_insert, table_id, bq_client, labels, schema, par
405407 source_format = bigquery .SourceFormat .NEWLINE_DELIMITED_JSON ,
406408 write_disposition = bigquery .job .WriteDisposition .WRITE_APPEND ,
407409 labels = labels ,
408- schema = schema
410+ schema = schema ,
411+ labels = labels
409412 )
410413
411414 job = bq_client .load_table_from_json (
0 commit comments