Skip to content

Commit 017e7aa

Browse files
Multimodal: Rename table names to use singular (#6)
1 parent fca72fe commit 017e7aa

18 files changed

+38
-38
lines changed

lightly_studio/src/lightly_studio/models/annotation/annotation_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ class AnnotationBaseTable(SQLModel, table=True):
5656

5757
annotation_id: UUID = Field(default_factory=uuid4, primary_key=True)
5858
annotation_type: AnnotationType
59-
annotation_label_id: UUID = Field(foreign_key="annotation_labels.annotation_label_id")
59+
annotation_label_id: UUID = Field(foreign_key="annotation_label.annotation_label_id")
6060

6161
confidence: Optional[float] = None
62-
dataset_id: UUID = Field(foreign_key="datasets.dataset_id")
63-
sample_id: UUID = Field(foreign_key="samples.sample_id")
62+
dataset_id: UUID = Field(foreign_key="dataset.dataset_id")
63+
sample_id: UUID = Field(foreign_key="sample.sample_id")
6464

6565
annotation_label: Mapped["AnnotationLabelTable"] = Relationship(
6666
sa_relationship_kwargs={"lazy": "select"},

lightly_studio/src/lightly_studio/models/annotation/instance_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
class InstanceSegmentationAnnotationTable(SQLModel, table=True):
2323
"""Database table model for instance segmentation annotations."""
2424

25-
__tablename__ = "instance_segmentation_annotations"
25+
__tablename__ = "instance_segmentation_annotation"
2626

2727
annotation_id: UUID = Field(
2828
default_factory=uuid4,

lightly_studio/src/lightly_studio/models/annotation/links.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ class AnnotationTagLinkTable(SQLModel, table=True):
1414
foreign_key="annotation_base.annotation_id",
1515
primary_key=True,
1616
)
17-
tag_id: Optional[UUID] = Field(default=None, foreign_key="tags.tag_id", primary_key=True)
17+
tag_id: Optional[UUID] = Field(default=None, foreign_key="tag.tag_id", primary_key=True)

lightly_studio/src/lightly_studio/models/annotation/object_detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
class ObjectDetectionAnnotationTable(SQLModel, table=True):
2121
"""Database table model for object detection annotations."""
2222

23-
__tablename__ = "object_detection_annotations"
23+
__tablename__ = "object_detection_annotation"
2424

2525
annotation_id: UUID = Field(
2626
default_factory=uuid4,

lightly_studio/src/lightly_studio/models/annotation/semantic_segmentation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
class SemanticSegmentationAnnotationTable(SQLModel, table=True):
2424
"""Model used to define semantic segmentation annotation table."""
2525

26-
__tablename__ = "semantic_segmentation_annotations"
26+
__tablename__ = "semantic_segmentation_annotation"
2727

2828
annotation_id: UUID = Field(
2929
default_factory=uuid4,

lightly_studio/src/lightly_studio/models/annotation_label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class AnnotationLabelView(AnnotationLabelBase):
3535
class AnnotationLabelTable(AnnotationLabelBase, table=True):
3636
"""This class defines the AnnotationLabel model."""
3737

38-
__tablename__ = "annotation_labels"
38+
__tablename__ = "annotation_label"
3939

4040
annotation_label_id: UUID = Field(default_factory=uuid4, primary_key=True)
4141
created_at: str = Field(

lightly_studio/src/lightly_studio/models/caption.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class CaptionTable(SQLModel, table=True):
2121
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc), index=True)
2222

2323
caption_id: UUID = Field(default_factory=uuid4, primary_key=True)
24-
dataset_id: UUID = Field(foreign_key="datasets.dataset_id")
25-
sample_id: UUID = Field(foreign_key="samples.sample_id")
24+
dataset_id: UUID = Field(foreign_key="dataset.dataset_id")
25+
sample_id: UUID = Field(foreign_key="sample.sample_id")
2626

2727
sample: Mapped[Optional["SampleTable"]] = Relationship(
2828
back_populates="captions",

lightly_studio/src/lightly_studio/models/dataset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class DatasetView(DatasetBase):
3737
class DatasetTable(DatasetBase, table=True):
3838
"""This class defines the Dataset model."""
3939

40-
__tablename__ = "datasets"
40+
__tablename__ = "dataset"
4141
dataset_id: UUID = Field(default_factory=uuid4, primary_key=True)
4242
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc), index=True)
4343
updated_at: datetime = Field(

lightly_studio/src/lightly_studio/models/embedding_model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EmbeddingModelBase(SQLModel):
1515
parameter_count_in_mb: int | None = None
1616
embedding_model_hash: str = Field(default="", sa_column=Column(CHAR(128)))
1717
embedding_dimension: int
18-
dataset_id: UUID = Field(default=None, foreign_key="datasets.dataset_id")
18+
dataset_id: UUID = Field(default=None, foreign_key="dataset.dataset_id")
1919

2020

2121
class EmbeddingModelCreate(EmbeddingModelBase):
@@ -25,6 +25,6 @@ class EmbeddingModelCreate(EmbeddingModelBase):
2525
class EmbeddingModelTable(EmbeddingModelBase, table=True):
2626
"""This class defines the EmbeddingModel model."""
2727

28-
__tablename__ = "embedding_models"
28+
__tablename__ = "embedding_model"
2929
embedding_model_id: UUID = Field(default_factory=uuid4, primary_key=True)
3030
created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc), index=True)

lightly_studio/src/lightly_studio/models/metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class SampleMetadataTable(MetadataBase, table=True):
188188
"""This class defines the SampleMetadataTable model."""
189189

190190
__tablename__ = "metadata"
191-
sample_id: UUID = Field(foreign_key="samples.sample_id", unique=True)
191+
sample_id: UUID = Field(foreign_key="sample.sample_id", unique=True)
192192

193193
sample: SampleTable = Relationship(back_populates="metadata_dict")
194194

0 commit comments

Comments
 (0)