Select Git revision
-
Maria Petrova-El Sayed authoredMaria Petrova-El Sayed authored
models_global_services.py NaN GiB
# coding: utf-8
"""
class StationmetaGlobalService (Base)
=====================================
"""
from sqlalchemy import CheckConstraint, Column, Integer, String, Sequence, ForeignKey
from sqlalchemy.orm import relationship
from .models_core import StationmetaCore
from toardb.base import Base
STATIONMETA_GLOBAL_SERVICES_ID_SEQ = Sequence('stationmeta_global_services_id_seq') # define sequence explicitly
class StationmetaGlobalService(Base):
""" Table "public.stationmeta_global_services"
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| Column | Type | Collation | Nullable | Default |
+====================+========================+===========+==========+=========================================================+
| id | integer | | not null | nextval('stationmeta_global_services_id_seq'::regclass) |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| variable_name | character varying(64) | | not null | |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| result_type | integer | | not null | |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| result_nvalues | integer | | not null | |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| service_valid_year | integer | | | |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
| service_url | character varying(200) | | not null | |
+--------------------+------------------------+-----------+----------+---------------------------------------------------------+
Indexes:
"stationmeta_global_services_pkey" PRIMARY KEY, btree (id)
"stationmeta_global_services_service_url_key" UNIQUE CONSTRAINT, btree (service_url)
"stationmeta_global_services_service_url_c8ee80c5_like" btree (service_url varchar_pattern_ops)
Check constraints:
"stationmeta_global_services_result_nvalues_check" CHECK (result_nvalues >= 0)
"stationmeta_global_services_result_type_check" CHECK (result_type >= 0)
"stationmeta_global_services_service_valid_year_check" CHECK (service_valid_year >= 0)
Foreign-key constraints:
"stationmeta_global_services_result_type_fk_rt_voc_enum_val" FOREIGN KEY (result_type) REFERENCES rt_vocabulary(enum_val)
"stationmeta_global_services_station_id_fkey" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id)
"""
__tablename__ = 'stationmeta_global_services'
__table_args__ = (
CheckConstraint('result_nvalues >= 0'),
CheckConstraint('result_type >= 0'),
CheckConstraint('service_valid_year >= 0')
)
id = Column(Integer, STATIONMETA_GLOBAL_SERVICES_ID_SEQ, primary_key=True, server_default=STATIONMETA_GLOBAL_SERVICES_ID_SEQ.next_value())
variable_name = Column(String(64), nullable=False)
result_type = Column(ForeignKey('rt_vocabulary.enum_val'), nullable=False)
result_nvalues = Column(Integer, nullable=False)
service_valid_year = Column(Integer)
service_url = Column(String(200), nullable=False, unique=True)
station_id = Column(ForeignKey(StationmetaCore.id))
station = relationship('StationmetaCore', back_populates='globalservice')
# rt_vocabulary = relationship('RtVocabulary')