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

Commit 9d7cae4

Browse files
Update connector.py
1 parent fcc6645 commit 9d7cae4

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

labelpandas/connector.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
1515
row_data_col : Required (str) - Column containing asset URL or file path
1616
global_key_col : Optional (str) - Column name containing the data row global key - defaults to row data
1717
external_id_col : Optional (str) - Column name containing the data row external ID - defaults to global key
18-
metadata_index : Optional (dict) - Dictionary where {key=column_name : value=metadata_type} - metadata_type = "enum", "string", "datetime" or "number"
18+
metadata_index : Optional (dict) - Dictionary where {key=column_name : value=metadata_type}
1919
local_files : Optional (bool) - If True, will create urls for local files; if False, uploads `row_data_col` as urls
2020
divider : Optional (str) - String delimiter for all name keys generated
2121
verbose : Optional (bool) - If True, prints information about code execution
@@ -30,14 +30,17 @@ def create_upload_dict(df:pandas.core.frame.DataFrame, lb_client:Client, base_cl
3030
external_id_col = external_id_col if external_id_col else global_key_col
3131
metadata_schema_to_name_key = base_client.get_metadata_schema_to_name_key(lb_mdo=False, divider=divider, invert=False)
3232
metadata_name_key_to_schema = base_client.get_metadata_schema_to_name_key(lb_mdo=False, divider=divider, invert=True)
33-
global_key_to_upload_dict = {}
3433
with ThreadPoolExecutor(max_workers=8) as exc:
34+
global_key_to_upload_dict = {}
3535
errors = []
3636
futures = []
3737
if verbose:
3838
print(f'Submitting data rows...')
3939
for index, row in df.iterrows():
40-
futures.append(exc.submit(create_data_rows, lb_client, base_client, row, metadata_name_key_to_schema, metadata_schema_to_name_key, row_data_col, global_key_col, external_id_col, metadata_index, local_files, divider))
40+
futures.append(exc.submit(
41+
create_data_rows, lb_client, base_client, row, metadata_name_key_to_schema, metadata_schema_to_name_key,
42+
row_data_col, global_key_col, external_id_col, metadata_index, local_files, divider
43+
))
4144
if verbose:
4245
print(f'Processing data rows...')
4346
for f in tqdm(as_completed(futures)):
@@ -68,9 +71,9 @@ def create_data_rows(lb_client:Client, base_client:baseClient, row:pandas.core.s
6871
metadata_name_key_to_schema : Required (dict) - Dictionary where {key=metadata_field_name_key : value=metadata_schema_id}
6972
metadata_schema_to_name_key : Required (dict) - Inverse of metadata_name_key_to_schema
7073
row_data_col : Required (str) - Column containing asset URL or file path
71-
global_key_col : Optional (str) - Column name containing the data row global key - defaults to row data
72-
external_id_col : Optional (str) - Column name containing the data row external ID - defaults to global key
73-
metadata_index : Optional (dict) - Dictionary where {key=column_name : value=metadata_type} - metadata_type = "enum", "string", "datetime" or "number"
74+
global_key_col : Optional (str) - Column name containing the data row global key
75+
external_id_col : Optional (str) - Column name containing the data row external ID
76+
metadata_index : Optional (dict) - Dictionary where {key=column_name : value=metadata_type}
7477
local_files : Optional (bool) - If True, will create urls for local files; if False, uploads `row_data_col` as urls
7578
divider : Optional (str) - String delimiter for all name keys generated
7679
Returns:

0 commit comments

Comments
 (0)