geomon/gschliefgraben_glasfaser/models.py
2022-02-21 16:07:04 +01:00

38 lines
1012 B
Python

'''
Tutorial link: https://docs.sqlalchemy.org/en/latest/orm/tutorial.html
Sqlalchemy version: 1.2.15
Python version: 3.7
'''
from datetime import datetime
# from config import db, ma
# import os
from sqlalchemy import (Column, Integer,
String, DateTime)
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import session
from marshmallow import Schema
from db.pg_models import create_pg_session
Base = declarative_base()
class Person(Base):
""" Platform class """
__tablename__ = 'person'
person_id = Column(Integer, primary_key=True)
lname = Column(String(32), index=True)
fname = Column(String(32))
timestamp = Column(DateTime, default=datetime.utcnow,
onupdate=datetime.utcnow)
class PersonSchema(Schema):
""" Platform class """
class Meta:
""" Platform class """
model = Person
#pg_session: session = create_pg_session()
sqla_session: session = create_pg_session()