File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change 1010from labelbox .schema .ontology import SchemaId
1111from labelbox .utils import camel_case
1212
13+ _MAX_METADATA_FIELDS = 5
14+
1315
1416class DataRowMetadataKind (Enum ):
1517 number = "CustomMetadataNumber"
@@ -292,6 +294,8 @@ def _batch_upsert(
292294
293295 items = []
294296 for m in metadata :
297+ if len (m .fields ) > _MAX_METADATA_FIELDS :
298+ raise ValueError (f"Cannot upload { len (m .fields )} , the max number is { _MAX_METADATA_FIELDS } " )
295299 items .append (
296300 _UpsertBatchDataRowMetadata (
297301 data_row_id = m .data_row_id ,
@@ -415,7 +419,7 @@ def _parse_upsert(
415419 elif schema .kind == DataRowMetadataKind .enum :
416420 parsed = _validate_enum_parse (schema , metadatum )
417421 elif schema .kind == DataRowMetadataKind .option :
418- raise ValueError ("An option id should not be as a schema id" )
422+ raise ValueError ("An Option id should not be set as the Schema id" )
419423 else :
420424 raise ValueError (f"Unknown type: { schema } " )
421425
You can’t perform that action at this time.
0 commit comments