-
Sabine Schröder authored
#8: common base and test base is in place (but teardown of test_base has to be worked on for chained pytests)
Sabine Schröder authored#8: common base and test base is in place (but teardown of test_base has to be worked on for chained pytests)
models.py 3.08 KiB
# coding: utf-8
from sqlalchemy import Column, Integer, String, Sequence
from sqlalchemy.orm import relationship
from sqlalchemy.sql.sqltypes import NullType
from sqlalchemy.dialects.postgresql import JSONB
from toardb.base import Base
VARIABLES_ID_SEQ = Sequence('variables_id_seq') # define sequence explicitly
class Variable(Base):
""" Table "public.variables"
+------------------+------------------------+-----------+----------+---------------------------------------+
| Column | Type | Collation | Nullable | Default |
+==================+========================+===========+==========+=======================================+
| id | integer | | not null | nextval('variables_id_seq'::regclass) |
+------------------+------------------------+-----------+----------+---------------------------------------+
| name | character varying(32) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
| longname | character varying(128) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
| displayname | character varying(128) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
| cf_standardname | character varying(128) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
| units | character varying(64) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
| chemical_formula | character varying(128) | | not null | |
+------------------+------------------------+-----------+----------+---------------------------------------+
Indexes:
"variables_pkey" PRIMARY KEY, btree (id)
"variables_name_key" UNIQUE CONSTRAINT, btree (name)
"variables_name_9bc98a13_like" btree (name varchar_pattern_ops)
Referenced by:
TABLE "timeseries" CONSTRAINT "timeseries_variable_id_dd9603f5_fk_variables_id" FOREIGN KEY (variable_id) REFERENCES variables(id) DEFERRABLE INITIALLY DEFERRED
"""
__tablename__ = 'variables'
id = Column(Integer, VARIABLES_ID_SEQ, primary_key=True, server_default=VARIABLES_ID_SEQ.next_value())
name = Column(String(32), nullable=False, unique=True)
longname = Column(String(128), nullable=False)
displayname = Column(String(128), nullable=False)
cf_standardname = Column(String(128), nullable=False)
units = Column(String(64), nullable=False)
chemical_formula = Column(String(128), nullable=False)