# coding: utf-8 """ class Organisation (Base) ========================= """ from sqlalchemy import CheckConstraint, Column, Integer, String, Sequence, ForeignKey from toardb.base import Base ORGANISATIONS_ID_SEQ = Sequence('organisations_id_seq') # define sequence explicitly class Organisation(Base): """ Table "public.organisations" +----------------+------------------------+-----------+----------+-------------------------------------------+ | Column | Type | Collation | Nullable | Default | +================+========================+===========+==========+===========================================+ | id | integer | | not null | nextval('organisations_id_seq'::regclass) | +----------------+------------------------+-----------+----------+-------------------------------------------+ | name | character varying(32) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | longname | character varying(256) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | kind | integer | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | city | character varying(64) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | postcode | character varying(16) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | street_address | character varying(128) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | country | character varying(64) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ | homepage | character varying(200) | | not null | | +----------------+------------------------+-----------+----------+-------------------------------------------+ Indexes: "organisations_pkey" PRIMARY KEY, btree (id) Check constraints: "organisations_kind_check" CHECK (kind >= 0) Foreign-key constraints: "organisations_kind_fk_ok_vocabulary_enum_val" FOREIGN KEY (kind) REFERENCES ok_vocabulary(enum_val) """ __tablename__ = 'organisations' __table_args__ = ( CheckConstraint('kind >= 0'), ) id = Column(Integer, ORGANISATIONS_ID_SEQ, primary_key=True, server_default=ORGANISATIONS_ID_SEQ.next_value()) name = Column(String(32), nullable=False) longname = Column(String(256), nullable=False) kind = Column(ForeignKey('ok_vocabulary.enum_val'), nullable=False) city = Column(String(64), nullable=False) postcode = Column(String(16), nullable=False) street_address = Column(String(128), nullable=False) country = Column(String(64), nullable=False) homepage = Column(String(200), nullable=False) # ok_vocabulary = relationship('OkVocabulary')