PIbd-42_SSPR/db/models/experiment_data_model.py
AnnZhimol 49e327005e Update Database:
+ch_experiment_data in click_house
+experiment_data and experiment_parameters in postgresql
+experiment_data has foreign_key from experiment_parameters
+new connections
+realize routes for ch_experiment_data
+new alg csv_to_db
+new methods in repos
+update dockerfile
+update readme "how to init db"
2024-10-25 01:02:31 +03:00

23 lines
659 B
Python

from typing import Optional
from sqlalchemy import Identity, ForeignKey
from sqlalchemy.orm import Mapped, mapped_column
from db.models.base import Base
class ExperimentData(Base):
__tablename__ = 'experiment_data'
id: Mapped[int] = mapped_column(Identity(start=21, cycle=True),
primary_key=True)
direction: Mapped[float]
temperature: Mapped[float]
nox: Mapped[float]
co2: Mapped[float]
co: Mapped[float]
file_id: Mapped[Optional[str]] = mapped_column(ForeignKey('experiment_parameters.experiment_hash', ondelete='SET NULL'))
def __repr__(self):
return f"<ExperimentData>"