backend/fastapi/app/db/models.py
2024-12-06 14:12:28 +09:00

64 lines
1.8 KiB
Python

from sqlalchemy import Column, Integer, String, CHAR, TIMESTAMP, VARCHAR, FLOAT, JSON, Numeric, DateTime, func, text
from .base import Base
class RawDatas(Base):
__tablename__ = "col_test_raw_data"
raw_dt = Column(TIMESTAMP, primary_key=True)
mg_equip_rtu_seq = Column(VARCHAR, primary_key=True)
acc_pg = Column(VARCHAR)
pg = Column(VARCHAR)
class Stat_pwr_rtu_1d_test(Base):
__tablename__ = "stat_pwr_rtu_1d_test"
stat_dt = Column(TIMESTAMP, primary_key=True)
rtu_seq = Column(Integer, primary_key=True)
stat_value = Column(FLOAT)
class Stat_pwr_rtu_1d(Base):
__tablename__ = "stat_pwr_rtu_1d"
stat_dt = Column(TIMESTAMP, primary_key=True)
rtu_seq = Column(Integer, primary_key=True)
stat_value = Column(FLOAT)
class Stat_weather_icsr_dc10tca_1d(Base):
__tablename__ = "stat_weather_icsr_dc10tca_1d"
tm = Column(TIMESTAMP, primary_key=True)
icsr_station_id = Column(VARCHAR)
icsr = Column(VARCHAR)
dc10tca_station_id = Column(VARCHAR)
dc10tca = Column(VARCHAR)
update_dt = Column(TIMESTAMP, nullable=True)
class Raw_data_herit(Base):
__tablename__ = "raw_data_herit"
seq = Column(Integer, primary_key=True, autoincrement="auto")
tm = Column(TIMESTAMP)
content_type = Column(VARCHAR)
x_hit_transactionid = Column(VARCHAR)
content_length = Column(VARCHAR)
body = Column(JSON)
class CardExpense(Base):
__tablename__ = "card_expenses"
id = Column(Integer, primary_key=True, index=True)
jang = Column(String(1), nullable=False)
yeo = Column(String(1), nullable=False)
kim = Column(String(1), nullable=False)
choi = Column(String(1), nullable=False)
amount = Column(Numeric(10), nullable=False)
purpose = Column(String(255), nullable=False)
created_at = Column(DateTime, nullable=False)