Start models implementation
This commit is contained in:
parent
0f547f9ee6
commit
4f508bb5bb
|
@ -2,6 +2,7 @@ from sqlalchemy import create_engine
|
|||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
|
||||
|
||||
SQLALCHEMY_DATABASE_URL = "sqlite:///./sql_app.db"
|
||||
# SQLALCHEMY_DATABASE_URL = "postgresql://user:password@postgresserver/db"
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, JSON
|
||||
from sqlalchemy.orm import relationship
|
||||
|
||||
from .database import Base
|
||||
|
||||
|
||||
class Sonde(Base):
|
||||
__tablename__ = "sonde"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
nom = Column(String, index=True)
|
||||
identifiant = Column(String, index=True, unique=True, nullable=False)
|
||||
# mesures = relationship("Mesure")
|
||||
|
||||
|
||||
class Mesure(Base):
|
||||
__tablename__ == "mesure"
|
||||
id = Column(Integer, primary_key=True, index=True)
|
||||
# sonde_id = Column(Integer, Foreignkey("sonde.id")
|
||||
content = Column(JSON, nullable=False)
|
Loading…
Reference in New Issue