Skip to content

Commit

Permalink
PR feedback: rename aana.models.db.BaseModel to BaseEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
evanderiel committed Dec 14, 2023
1 parent 4bf5b67 commit 8f92d47
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions aana/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from aana.configs.db import create_database_engine
from aana.configs.settings import settings
from aana.models.db.base import BaseModel
from aana.models.db.base import BaseEntity

# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
Expand All @@ -21,7 +21,7 @@
# from myapp import mymodel
# target_metadata = mymodel.Base.metadata

target_metadata = BaseModel.metadata
target_metadata = BaseEntity.metadata

# other values from the config, defined by the needs of env.py,
# can be acquired:
Expand Down
2 changes: 1 addition & 1 deletion aana/models/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/database/sqlalchemy.html#importing-all-sqlalchemy-models
# (even if not using Pyramid)

from aana.models.db.base import BaseModel
from aana.models.db.base import BaseEntity
from aana.models.db.caption import CaptionEntity
from aana.models.db.media import MediaEntity, MediaType
from aana.models.db.transcript import TranscriptEntity
Expand Down
2 changes: 1 addition & 1 deletion aana/models/db/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sqlalchemy.orm import DeclarativeBase


class BaseModel(DeclarativeBase):
class BaseEntity(DeclarativeBase):
"""Base for all ORM classes."""

pass
Expand Down
4 changes: 2 additions & 2 deletions aana/models/db/caption.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from sqlalchemy.orm import relationship

from aana.configs.db import MediaIdSqlType, media_id_type
from aana.models.db.base import BaseModel, TimeStampEntity
from aana.models.db.base import BaseEntity, TimeStampEntity
from aana.models.pydantic.captions import Caption


class CaptionEntity(BaseModel, TimeStampEntity):
class CaptionEntity(BaseEntity, TimeStampEntity):
"""ORM model for video captions."""

__tablename__ = "captions"
Expand Down
4 changes: 2 additions & 2 deletions aana/models/db/media.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from sqlalchemy import Column, ForeignKey, Integer, String

from aana.configs.db import MediaIdSqlType
from aana.models.db.base import BaseModel, TimeStampEntity
from aana.models.db.base import BaseEntity, TimeStampEntity


class MediaType(str, Enum):
Expand All @@ -12,7 +12,7 @@ class MediaType(str, Enum):
VIDEO = "video"


class MediaEntity(BaseModel, TimeStampEntity):
class MediaEntity(BaseEntity, TimeStampEntity):
"""Table for media items."""

__tablename__ = "media"
Expand Down
4 changes: 2 additions & 2 deletions aana/models/db/transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from sqlalchemy.orm import relationship

from aana.configs.db import MediaIdSqlType, media_id_type
from aana.models.db.base import BaseModel, TimeStampEntity
from aana.models.db.base import BaseEntity, TimeStampEntity

if TYPE_CHECKING:
from aana.models.pydantic.asr_output import (
Expand All @@ -16,7 +16,7 @@
)


class TranscriptEntity(BaseModel, TimeStampEntity):
class TranscriptEntity(BaseEntity, TimeStampEntity):
"""ORM class for media transcripts generated by a model."""

__tablename__ = "transcripts"
Expand Down
5 changes: 2 additions & 3 deletions aana/models/db/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from sqlalchemy.orm import relationship

from aana.configs.db import MediaIdSqlType
from aana.models.db.base import BaseModel, TimeStampEntity
from aana.models.db.base import BaseEntity, TimeStampEntity


class VideoEntity(BaseModel, TimeStampEntity):
class VideoEntity(BaseEntity, TimeStampEntity):
"""ORM class for videp file (video, etc)."""

__tablename__ = "video"
Expand All @@ -18,7 +18,6 @@ class VideoEntity(BaseModel, TimeStampEntity):
comment="Foreign key to media table",
)
duration = Column(Float, comment="Media duration in seconds")
media_type = Column(String, comment="Media type")
orig_filename = Column(String, comment="Original filename")
orig_url = Column(String, comment="Original URL")

Expand Down
4 changes: 2 additions & 2 deletions aana/repository/datastore/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from aana.configs.db import media_id_type
from aana.exceptions.database import NotFoundException
from aana.models.db import BaseModel
from aana.models.db import BaseEntity

T = TypeVar("T", bound=BaseModel)
T = TypeVar("T", bound=BaseEntity)


# Does not yet have an update method because I'm not sure if we'll need one.
Expand Down

0 comments on commit 8f92d47

Please sign in to comment.