For SQLAlchemy using SQLite, I want to create a series of tables to manage Tags and Images, the specific structures I have are:
- TagSource - This is the source of the tagging for a specific Image, it has a name, such as "wd14_moatv2" to indicate where we got the tag from
- Tags - This is a list of all the actual tags, such as "1girl" or "looking at viewer", I also want to be able to create Tag Aliases where 1 tag might be able to be found via another, like "pov" might be aliased out to "point of view" or "first person view", so if someone searched for "point of view", it finds all tags within that alias set(but there is always a "primary" tag, that if we just want a single tag returned, it will default to the primary tag)
- ImageTag - This is a table to link Images to Tags, we also link the TagSource here, the TagSource is where the "score", a floating point number that we use as a metric of how the TagSource scored this tag to this image, with 1.0 being the TagSource being 100% sure the image contains the concept this tag suggests, and 0.5 is 50% certainty, but an Image might get tagged by multiple sources, with the same tags being linked, but at different scores, so we need to identify the TagSource here.

I also have this in a models folder using tag.py, with a core.py containing the base models:

```
from sqlalchemy import DateTime, func
from sqlalchemy.orm import declarative_base, mapped_column

from database.database import session, engine


Model = declarative_base()
Model.query = session.query_property()
Model.metadata.create_all(bind=engine)

class TimeStampedModel(Model):
    __abstract__ = True

    created_at = mapped_column(DateTime(timezone=True), default=func.now())
    updated_at = mapped_column(DateTime(timezone=True), default=func.now(), onupdate=func.now())
```

And image.py:

```
from sqlalchemy import Index, Integer, Table, String, Text, ForeignKey, DateTime, func
from sqlalchemy import UniqueConstraint, CheckConstraint, MetaData
from sqlalchemy.orm import Mapped
from sqlalchemy.orm import mapped_column
from sqlalchemy.orm import relationship, declared_attr

from .core import TimeStampedModel


class Image(TimeStampedModel):
    __tablename__ = "images"

    # columns
    id: Mapped[int] = mapped_column(primary_key=True)
    image_file: Mapped[str] = mapped_column(unique=True)
    ahash: Mapped[str] = mapped_column(String(64), index=True)
    width: Mapped[int] # Image Width
    height: Mapped[int] # Image Height

    # relationships

    # methods
    def __repr__(self):
        return f"{self.__tablename__!r}(id={self.id!r}, image_file={self.image_file!r}, width={self.width!r}, height={self.height!r}, ahash={self.ahash!r})"
```

And the core of the functionality, the database.py:

```
from sqlalchemy import create_engine, MetaData, Table, Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session


DATABASE_URL = "sqlite:///./aidili.db"
engine = create_engine(
    DATABASE_URL,
    connect_args={"check_same_thread": False},
    echo=True,
)

SessionLocal = scoped_session( sessionmaker(autocommit=False, autoflush=False, bind=engine) )

metadata = MetaData()
```

I want a full SQLAlchemy built ORM model structure for how you would design such a relational set of tables for a SQLite database.