from labelbox.orm import query
from labelbox.orm.db_object import DbObject, Updateable, BulkDeletable
from labelbox.orm.model import Entity, Field, Relationship
from labelbox.schema.asset_metadata import AssetMetadata
[docs]class DataRow(DbObject, Updateable, BulkDeletable):
""" Internal Labelbox representation of a single piece of data (e.g. image, video, text).
Attributes:
external_id (str): User-generated file name or identifier
row_data (str): Paths to local files are uploaded to Labelbox's server.
Otherwise, it's treated as an external URL.
updated_at (datetime)
created_at (datetime)
dataset (Relationship): `ToOne` relationship to Dataset
created_by (Relationship): `ToOne` relationship to User
organization (Relationship): `ToOne` relationship to Organization
labels (Relationship): `ToMany` relationship to Label
metadata (Relationship): `ToMany` relationship to AssetMetadata
predictions (Relationship): `ToMany` relationship to Prediction
"""
external_id = Field.String("external_id")
row_data = Field.String("row_data")
updated_at = Field.DateTime("updated_at")
created_at = Field.DateTime("created_at")
# Relationships
dataset = Relationship.ToOne("Dataset")
created_by = Relationship.ToOne("User", False, "created_by")
organization = Relationship.ToOne("Organization", False)
labels = Relationship.ToMany("Label", True)
metadata = Relationship.ToMany("AssetMetadata", False, "metadata")
predictions = Relationship.ToMany("Prediction", False)
supported_meta_types = {
meta_type.value for meta_type in AssetMetadata.MetaType
}
[docs] @staticmethod
def bulk_delete(data_rows):
""" Deletes all the given DataRows.
Args:
data_rows (list of DataRow): The DataRows to delete.
"""
BulkDeletable._bulk_delete(data_rows, True)
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.metadata.supports_filtering = False
self.metadata.supports_sorting = False