class FeatureVector(Base, BaseModel): __tablename__ = "feature_vectors" __table_args__ = (UniqueConstraint("name", "project", "uid", name="_feature_vectors_uc"), ) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation())) project = Column(String(255, collation=SQLCollationUtil.collation())) created = Column(TIMESTAMP, default=datetime.now(timezone.utc)) updated = Column(TIMESTAMP, default=datetime.now(timezone.utc)) state = Column(String(255, collation=SQLCollationUtil.collation())) uid = Column(String(255, collation=SQLCollationUtil.collation())) _full_object = Column("object", JSON) Label = make_label(__tablename__) Tag = make_tag_v2(__tablename__) labels = relationship(Label, cascade="all, delete-orphan") tags = relationship(Tag, cascade="all, delete-orphan") def get_identifier_string(self) -> str: return f"{self.project}/{self.name}/{self.uid}" @property def full_object(self): if self._full_object: return json.loads(self._full_object) @full_object.setter def full_object(self, value): self._full_object = json.dumps(value)
class Project(Base, BaseModel): __tablename__ = "projects" # For now since we use project name a lot __table_args__ = (UniqueConstraint("name", name="_projects_uc"), ) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation())) description = Column( String(255, collation=SQLCollationUtil.collation())) owner = Column(String(255, collation=SQLCollationUtil.collation())) source = Column(String(255, collation=SQLCollationUtil.collation())) # the attribute name used to be _spec which is just a wrong naming, the attribute was renamed to _full_object # leaving the column as is to prevent redundant migration # TODO: change to JSON, see mlrun/api/schemas/function.py::FunctionState for reasoning _full_object = Column("spec", sqlalchemy.dialects.mysql.MEDIUMBLOB) created = Column(TIMESTAMP, default=datetime.utcnow) state = Column(String(255, collation=SQLCollationUtil.collation())) users = relationship(User, secondary=project_users) Label = make_label(__tablename__) labels = relationship(Label, cascade="all, delete-orphan") def get_identifier_string(self) -> str: return f"{self.name}" @property def full_object(self): if self._full_object: return pickle.loads(self._full_object) @full_object.setter def full_object(self, value): self._full_object = pickle.dumps(value)
class Tag(Base, BaseModel): __tablename__ = f"{table}_tags" __table_args__ = ( UniqueConstraint("project", "name", "obj_id", name=f"_{table}_tags_uc"), ) id = Column(Integer, primary_key=True) project = Column(String(255, collation=SQLCollationUtil.collation())) name = Column(String(255, collation=SQLCollationUtil.collation())) obj_id = Column(Integer, ForeignKey(f"{table}.id"))
class Label(Base, BaseModel): __tablename__ = f"{table}_labels" __table_args__ = (UniqueConstraint("name", "parent", name=f"_{table}_labels_uc"), ) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation())) value = Column(String(255, collation=SQLCollationUtil.collation())) parent = Column(Integer, ForeignKey(f"{table}.id"))
class Log(Base, BaseModel): __tablename__ = "logs" id = Column(Integer, primary_key=True) uid = Column(String(255, collation=SQLCollationUtil.collation())) project = Column(String(255, collation=SQLCollationUtil.collation())) # TODO: change to JSON, see mlrun/api/schemas/function.py::FunctionState for reasoning body = Column(sqlalchemy.dialects.mysql.MEDIUMBLOB) def get_identifier_string(self) -> str: return f"{self.project}/{self.uid}"
class Entity(Base, BaseModel): __tablename__ = "entities" id = Column(Integer, primary_key=True) feature_set_id = Column(Integer, ForeignKey("feature_sets.id")) name = Column(String(255, collation=SQLCollationUtil.collation())) value_type = Column(String(255, collation=SQLCollationUtil.collation())) Label = make_label(__tablename__) labels = relationship(Label, cascade="all, delete-orphan") def get_identifier_string(self) -> str: return f"{self.project}/{self.name}"
def upgrade(): with op.batch_alter_table("feature_sets_tags") as batch_op: batch_op.alter_column( column_name="obj_name", type_=sa.String(255, collation=SQLCollationUtil.collation()), ) with op.batch_alter_table("feature_vectors_tags") as batch_op: batch_op.alter_column( column_name="obj_name", type_=sa.String(255, collation=SQLCollationUtil.collation()), ) with op.batch_alter_table("functions_tags") as batch_op: batch_op.alter_column( column_name="obj_name", type_=sa.String(255, collation=SQLCollationUtil.collation()), )
class DataVersion(Base, BaseModel): __tablename__ = "data_versions" __table_args__ = (UniqueConstraint("version", name="_versions_uc"), ) id = Column(Integer, primary_key=True) version = Column(String(255, collation=SQLCollationUtil.collation())) created = Column(TIMESTAMP, default=datetime.now(timezone.utc))
def upgrade(): with op.batch_alter_table("schedules_v2") as batch_op: batch_op.add_column( sa.Column( "last_run_uri", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "entities_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["parent"], ["entities.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_entities_labels_uc"), ) op.create_table( "features_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["parent"], ["features.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_features_labels_uc"), )
class Function(Base, HasStruct): __tablename__ = "functions" __table_args__ = ( UniqueConstraint("name", "project", "uid", name="_functions_uc"), ) Label = make_label(__tablename__) Tag = make_tag_v2(__tablename__) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation())) project = Column(String(255, collation=SQLCollationUtil.collation())) uid = Column(String(255, collation=SQLCollationUtil.collation())) # TODO: change to JSON, see mlrun/api/schemas/function.py::FunctionState for reasoning body = Column(BLOB) updated = Column(TIMESTAMP) labels = relationship(Label) def get_identifier_string(self) -> str: return f"{self.project}/{self.name}/{self.uid}"
class Artifact(Base, HasStruct): __tablename__ = "artifacts" __table_args__ = (UniqueConstraint("uid", "project", "key", name="_artifacts_uc"), ) Label = make_label(__tablename__) Tag = make_tag(__tablename__) id = Column(Integer, primary_key=True) key = Column(String(255, collation=SQLCollationUtil.collation())) project = Column(String(255, collation=SQLCollationUtil.collation())) uid = Column(String(255, collation=SQLCollationUtil.collation())) updated = Column(TIMESTAMP) # TODO: change to JSON, see mlrun/api/schemas/function.py::FunctionState for reasoning body = Column(sqlalchemy.dialects.mysql.MEDIUMBLOB) labels = relationship(Label, cascade="all, delete-orphan") tags = relationship(Tag, cascade="all, delete-orphan") def get_identifier_string(self) -> str: return f"{self.project}/{self.key}/{self.uid}"
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "marketplace_sources", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("index", sa.Integer(), nullable=True), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column("object", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", name="_marketplace_sources_uc"), )
class Schedule(Base, BaseModel): __tablename__ = "schedules_v2" __table_args__ = (UniqueConstraint("project", "name", name="_schedules_v2_uc"), ) Label = make_label(__tablename__) id = Column(Integer, primary_key=True) project = Column(String(255, collation=SQLCollationUtil.collation()), nullable=False) name = Column(String(255, collation=SQLCollationUtil.collation()), nullable=False) kind = Column(String(255, collation=SQLCollationUtil.collation())) desired_state = Column( String(255, collation=SQLCollationUtil.collation())) state = Column(String(255, collation=SQLCollationUtil.collation())) creation_time = Column(TIMESTAMP) cron_trigger_str = Column( String(255, collation=SQLCollationUtil.collation())) last_run_uri = Column( String(255, collation=SQLCollationUtil.collation())) # TODO: change to JSON, see mlrun/api/schemas/function.py::FunctionState for reasoning struct = Column(sqlalchemy.dialects.mysql.MEDIUMBLOB) labels = relationship(Label, cascade="all, delete-orphan") concurrency_limit = Column(Integer, nullable=False) def get_identifier_string(self) -> str: return f"{self.project}/{self.name}" @property def scheduled_object(self): return pickle.loads(self.struct) @scheduled_object.setter def scheduled_object(self, value): self.struct = pickle.dumps(value) @property def cron_trigger(self) -> schemas.ScheduleCronTrigger: return orjson.loads(self.cron_trigger_str) @cron_trigger.setter def cron_trigger(self, trigger: schemas.ScheduleCronTrigger): self.cron_trigger_str = orjson.dumps( trigger.dict(exclude_unset=True))
class MarketplaceSource(Base, BaseModel): __tablename__ = "marketplace_sources" __table_args__ = (UniqueConstraint("name", name="_marketplace_sources_uc"),) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation())) index = Column(Integer) created = Column(TIMESTAMP, default=datetime.now(timezone.utc)) updated = Column(TIMESTAMP, default=datetime.now(timezone.utc)) _full_object = Column("object", JSON) def get_identifier_string(self) -> str: return f"{self.project}/{self.name}" @property def full_object(self): if self._full_object: return json.loads(self._full_object) @full_object.setter def full_object(self, value): self._full_object = json.dumps(value)
class User(Base, BaseModel): __tablename__ = "users" __table_args__ = (UniqueConstraint("name", name="_users_uc"), ) id = Column(Integer, primary_key=True) name = Column(String(255, collation=SQLCollationUtil.collation()))
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "artifacts", sa.Column("id", sa.Integer(), nullable=False), sa.Column("key", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("uid", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column("body", sa.BLOB(), nullable=True), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("uid", "project", "key", name="_artifacts_uc"), ) op.create_table( "functions", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("uid", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True), sa.Column("body", sa.BLOB(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "project", "uid", name="_functions_uc"), ) op.create_table( "logs", sa.Column("id", sa.Integer(), nullable=False), sa.Column("uid", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("body", sa.BLOB(), nullable=True), sa.PrimaryKeyConstraint("id"), ) op.create_table( "projects", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "description", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "owner", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "source", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("spec", sa.BLOB(), nullable=True), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column( "state", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", name="_projects_uc"), ) op.create_table( "runs", sa.Column("id", sa.Integer(), nullable=False), sa.Column("uid", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("iteration", sa.Integer(), nullable=True), sa.Column( "state", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("body", sa.BLOB(), nullable=True), sa.Column("start_time", sa.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("uid", "project", "iteration", name="_runs_uc"), ) op.create_table( "schedules_v2", sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=False, ), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=False, ), sa.Column( "kind", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "desired_state", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "state", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("creation_time", sa.TIMESTAMP(), nullable=True), sa.Column( "cron_trigger_str", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("struct", sa.BLOB(), nullable=True), sa.PrimaryKeyConstraint("project", "name"), ) op.create_table( "users", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", name="_users_uc"), ) op.create_table( "artifacts_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["parent"], ["artifacts.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_artifacts_labels_uc"), ) op.create_table( "artifacts_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["obj_id"], ["artifacts.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("project", "name", "obj_id", name="_artifacts_tags_uc"), ) op.create_table( "functions_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["parent"], ["functions.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_functions_labels_uc"), ) op.create_table( "functions_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.Column( "obj_name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint( ["obj_id"], ["functions.id"], ), sa.ForeignKeyConstraint( ["obj_name"], ["functions.name"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("project", "name", "obj_name", name="_functions_tags_uc"), ) op.create_table( "project_users", sa.Column("project_id", sa.Integer(), nullable=True), sa.Column("user_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["project_id"], ["projects.id"], ), sa.ForeignKeyConstraint( ["user_id"], ["users.id"], ), ) op.create_table( "runs_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["parent"], ["runs.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_runs_labels_uc"), ) op.create_table( "runs_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint( ["obj_id"], ["runs.id"], ), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("project", "name", "obj_id", name="_runs_tags_uc"), )
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "feature_vectors", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column( "state", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "uid", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True ), sa.Column("object", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "project", "uid", name="_feature_vectors_uc"), ) op.create_table( "feature_vectors_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["feature_vectors.id"],), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint("name", "parent", name="_feature_vectors_labels_uc"), ) op.create_table( "feature_vectors_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.Column( "obj_name", sa.String(255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["obj_id"], ["feature_vectors.id"],), sa.ForeignKeyConstraint(["obj_name"], ["feature_vectors.name"],), sa.PrimaryKeyConstraint("id"), sa.UniqueConstraint( "project", "name", "obj_name", name="_feature_vectors_tags_uc" ), )
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table( "artifacts", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "key", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column("body", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.PrimaryKeyConstraint("id", name="_artifacts_pk"), sa.UniqueConstraint("uid", "project", "key", name="_artifacts_uc"), ) op.create_table( "feature_sets", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column( "state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("object", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id", name="_feature_sets_pk"), sa.UniqueConstraint("name", "project", "uid", name="_feature_set_uc"), ) op.create_table( "feature_vectors", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column( "state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("object", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id", name="_feature_vectors_pk"), sa.UniqueConstraint("name", "project", "uid", name="_feature_vectors_uc"), ) op.create_table( "functions", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("body", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint("id", name="_functions_pk"), sa.UniqueConstraint("name", "project", "uid", name="_functions_uc"), ) op.create_table( "logs", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("body", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.PrimaryKeyConstraint("id", name="_logs_pk"), ) op.create_table( "marketplace_sources", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("index", sa.Integer(), nullable=True), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column("updated", sa.TIMESTAMP(), nullable=True), sa.Column("object", sa.JSON(), nullable=True), sa.PrimaryKeyConstraint("id", name="_marketplace_sources_pk"), sa.UniqueConstraint("name", name="_marketplace_sources_uc"), ) op.create_table( "projects", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "description", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "owner", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "source", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("spec", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.Column("created", sa.TIMESTAMP(), nullable=True), sa.Column( "state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.PrimaryKeyConstraint("id", name="_projects_pk"), sa.UniqueConstraint("name", name="_projects_uc"), ) op.create_table( "runs", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "uid", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("iteration", sa.Integer(), nullable=True), sa.Column( "state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("body", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.Column("start_time", sa.TIMESTAMP(), nullable=True), sa.PrimaryKeyConstraint("id", name="_runs_pk"), sa.UniqueConstraint("uid", "project", "iteration", name="_runs_uc"), ) op.create_table( "schedules_v2", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=False, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=False, ), sa.Column( "kind", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "desired_state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "state", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("creation_time", sa.TIMESTAMP(), nullable=True), sa.Column( "cron_trigger_str", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "last_run_uri", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("struct", sqlalchemy.dialects.mysql.MEDIUMBLOB(), nullable=True), sa.Column("concurrency_limit", sa.Integer(), nullable=False), sa.PrimaryKeyConstraint("id", name="_schedules_v2_pk"), sa.UniqueConstraint("project", "name", name="_schedules_v2_uc"), ) op.create_table( "users", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.PrimaryKeyConstraint("id", name="_users_pk"), sa.UniqueConstraint("name", name="_users_uc"), ) op.create_table( "artifacts_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["artifacts.id"], name="_artifacts_labels_paren_fk"), sa.PrimaryKeyConstraint("id", name="_artifacts_labels_pk"), sa.UniqueConstraint("name", "parent", name="_artifacts_labels_uc"), ) op.create_table( "artifacts_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["obj_id"], ["artifacts.id"], name="_artifacts_tags_obj_id_fk"), sa.PrimaryKeyConstraint("id", name="_artifacts_tags_pk"), sa.UniqueConstraint("project", "name", "obj_id", name="_artifacts_tags_uc"), ) op.create_table( "entities", sa.Column("id", sa.Integer(), nullable=False), sa.Column("feature_set_id", sa.Integer(), nullable=True), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value_type", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["feature_set_id"], ["feature_sets.id"], name="_entities_feature_set_id_fk"), sa.PrimaryKeyConstraint("id", name="_entities_pk"), ) op.create_table( "feature_sets_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["feature_sets.id"], name="_feature_sets_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_feature_sets_labels_pk"), sa.UniqueConstraint("name", "parent", name="_feature_sets_labels_uc"), ) op.create_table( "feature_sets_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.Column( "obj_name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["obj_id"], ["feature_sets.id"], name="_feature_sets_tags_obj_id_fk"), sa.ForeignKeyConstraint(["obj_name"], ["feature_sets.name"], name="_feature_sets_tags_obj_name_fk"), sa.PrimaryKeyConstraint("id", name="_feature_sets_tags_pk"), sa.UniqueConstraint("project", "name", "obj_name", name="_feature_sets_tags_uc"), ) op.create_table( "feature_vectors_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["feature_vectors.id"], name="_feature_vectors_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_feature_vectors_labels_pk"), sa.UniqueConstraint("name", "parent", name="_feature_vectors_labels_uc"), ) op.create_table( "feature_vectors_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.Column( "obj_name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["obj_id"], ["feature_vectors.id"], name="_feature_vectors_tags_obj_id_fk"), sa.ForeignKeyConstraint( ["obj_name"], ["feature_vectors.name"], name="_feature_vectors_tags_obj_name_fk", ), sa.PrimaryKeyConstraint("id", name="_feature_vectors_tags_pk"), sa.UniqueConstraint("project", "name", "obj_name", name="_feature_vectors_tags_uc"), ) op.create_table( "features", sa.Column("id", sa.Integer(), nullable=False), sa.Column("feature_set_id", sa.Integer(), nullable=True), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value_type", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["feature_set_id"], ["feature_sets.id"], name="_features_feature_set_id_fk"), sa.PrimaryKeyConstraint("id", name="_features_pk"), ) op.create_table( "functions_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["functions.id"], name="_functions_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_functions_labels_pk"), sa.UniqueConstraint("name", "parent", name="_functions_labels_uc"), ) op.create_table( "functions_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.Column( "obj_name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.ForeignKeyConstraint(["obj_id"], ["functions.id"], name="_functions_tags_obj_id_fk"), sa.ForeignKeyConstraint(["obj_name"], ["functions.name"], name="_functions_tags_obj_name_fk"), sa.PrimaryKeyConstraint("id", name="_functions_tags_pk"), sa.UniqueConstraint("project", "name", "obj_name", name="_functions_tags_uc"), ) op.create_table( "project_users", sa.Column("project_id", sa.Integer(), nullable=True), sa.Column("user_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["project_id"], ["projects.id"], name="_project_users_project_id_fk"), sa.ForeignKeyConstraint(["user_id"], ["users.id"], name="_project_users_user_id_fk"), ) op.create_table( "projects_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["projects.id"], name="_projects_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_projects_labels_pk"), sa.UniqueConstraint("name", "parent", name="_projects_labels_uc"), ) op.create_table( "runs_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["runs.id"], name="_runs_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_runs_labels_pk"), sa.UniqueConstraint("name", "parent", name="_runs_labels_uc"), ) op.create_table( "runs_tags", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "project", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("obj_id", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["obj_id"], ["runs.id"], name="_runs_tags_obj_id_fk"), sa.PrimaryKeyConstraint("id", name="_runs_tags_pk"), sa.UniqueConstraint("project", "name", "obj_id", name="_runs_tags_uc"), ) op.create_table( "schedules_v2_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["schedules_v2.id"], name="_schedules_v2_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_schedules_v2_labels_pk"), sa.UniqueConstraint("name", "parent", name="_schedules_v2_labels_uc"), ) op.create_table( "entities_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["entities.id"], name="_entities_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_entities_labels_pk"), sa.UniqueConstraint("name", "parent", name="_entities_labels_uc"), ) op.create_table( "features_labels", sa.Column("id", sa.Integer(), nullable=False), sa.Column( "name", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column( "value", sa.String(length=255, collation=SQLCollationUtil.collation()), nullable=True, ), sa.Column("parent", sa.Integer(), nullable=True), sa.ForeignKeyConstraint(["parent"], ["features.id"], name="_features_labels_parent_fk"), sa.PrimaryKeyConstraint("id", name="_features_labels_pk"), sa.UniqueConstraint("name", "parent", name="_features_labels_uc"), )