Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 3f19ddc

Browse files
Update data_rows.py
1 parent 7fb1366 commit 3f19ddc

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

labelpandas/data_rows.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def create_data_row_upload_dict(client:labelboxClient, table:pd.core.frame.DataFrame,
99
row_data_col:str, global_key_col:str, external_id_col:str, dataset_id_col:str,
1010
dataset_id:str, metadata_index:dict, attachment_index:dict,
11-
divider:str, verbose:bool):
11+
divider:str, verbose:bool, extra_client:bool=None):
1212
""" Multithreads over a Pandas DataFrame, calling create_data_rows() on each row to return an upload dictionary
1313
Args:
1414
client : Required (labelbox.client.Client) - Labelbox Client object
@@ -22,15 +22,16 @@ def create_data_row_upload_dict(client:labelboxClient, table:pd.core.frame.DataF
2222
attachment_index : Required (dict) - Dictonary where {key=column_name : value=attachment_type}
2323
divider : Required (str) - String delimiter for all name keys generated
2424
verbose : Required (bool) - If True, prints details about code execution; if False, prints minimal information
25+
extra_client : Ignore this value - necessary for other labelbase integrations
2526
Returns:
2627
Two values:
2728
- global_key_to_upload_dict - Dictionary where {key=global_key : value=data row dictionary in upload format}
2829
- errors - List of dictionaries containing conversion error information; see connector.create_data_rows() for more information
2930
"""
30-
table_length = connector.get_table_length_function(table=table)
31+
table_length = connector.get_table_length_function(table=table, extra_client=extra_client)
3132
if verbose:
3233
print(f'Creating upload list - {table_length} rows in Pandas DataFrame')
33-
if table_length != connector.get_unique_values_function(table=table, column_name=global_key_col):
34+
if table_length != connector.get_unique_values_function(table=table, column_name=global_key_col, extra_client=extra_client):
3435
print(f"Warning: Your global key column is not unique - upload will resume, only uploading 1 data row per unique global key")
3536
metadata_schema_to_name_key = labelbase.metadata.get_metadata_schema_to_name_key(client=lb_client, lb_mdo=False, divider=divider, invert=False)
3637
metadata_name_key_to_schema = labelbase.metadata.get_metadata_schema_to_name_key(client=lb_client, lb_mdo=False, divider=divider, invert=True)

0 commit comments

Comments
 (0)