-
Sabine Schröder authored
adapted sphinx documentation to new structure (ONE app); some pretty printing (fastAPI does not provide sphinx extensions like django)
Sabine Schröder authoredadapted sphinx documentation to new structure (ONE app); some pretty printing (fastAPI does not provide sphinx extensions like django)
models_global.py 8.28 KiB
# coding: utf-8
"""
class StationmetaGlobal (Base)
==============================
"""
from sqlalchemy import Column, DateTime, Float, ForeignKey, Integer, text, String, \
Text, CheckConstraint
from geoalchemy2.types import Geometry
from sqlalchemy.orm import relationship
from sqlalchemy.dialects.postgresql import JSONB, ARRAY
from sqlalchemy.ext.declarative import declarative_base
from shapely import wkt
from .models_core import StationmetaCore
Base = declarative_base()
metadata = Base.metadata
class StationmetaGlobal(Base):
""" Table "public.stationmeta_global"
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| Column | Type | Collation | Nullable | Default |
+======================================+==================+===========+==========+================================================+
| id | integer | | not null | nextval('stationmeta_global_id_seq'::regclass) |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| population_density_year2010 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| max_population_density_25km_year2010 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| climatic_zone | integer | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| nightlight_1km_year2013 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| nightlight_5km_year2013 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| max_nightlight_25km_year2013 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| wheat_production_year2000 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| rice_production_year2000 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| edgar_htap_v2_nox_emissions_year2010 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| omi_no2_column_years2011to2015 | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| htap_region_tier1 | integer | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| etopo_alt | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| etopo_min_alt_5km | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| etopo_relative_alt | double precision | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| dominant_landcover_year2012 | integer | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| toar1_category | integer | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
| station_id | integer | | not null | |
+--------------------------------------+------------------+-----------+----------+------------------------------------------------+
Indexes:
"stationmeta_global_pkey" PRIMARY KEY, btree (id)
"stationmeta_global_station_id_key" UNIQUE CONSTRAINT, btree (station_id)
Check constraints:
"stationmeta_global_climatic_zone_check" CHECK (climatic_zone >= 0)
"stationmeta_global_dominant_landcover_year2012_check" CHECK (dominant_landcover_year2012 >= 0)
"stationmeta_global_htap_region_tier1_check" CHECK (htap_region_tier1 >= 0)
"stationmeta_global_toar1_category_check" CHECK (toar1_category >= 0)
Foreign-key constraints:
"stationmeta_global_station_id_29ff53dd_fk_stationmeta_core_id" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED
"""
__tablename__ = 'stationmeta_global'
__table_args__ = (
CheckConstraint('climatic_zone >= 0'),
CheckConstraint('dominant_landcover_year2012 >= 0'),
CheckConstraint('htap_region_tier1 >= 0'),
CheckConstraint('toar1_category >= 0')
)
id = Column(Integer, primary_key=True, server_default=text("nextval('stationmeta_global_id_seq'::regclass)"))
population_density_year2010 = Column(Float(53), nullable=False)
max_population_density_25km_year2010 = Column(Float(53), nullable=False)
climatic_zone = Column(Integer, nullable=False)
nightlight_1km_year2013 = Column(Float(53), nullable=False)
nightlight_5km_year2013 = Column(Float(53), nullable=False)
max_nightlight_25km_year2013 = Column(Float(53), nullable=False)
wheat_production_year2000 = Column(Float(53), nullable=False)
rice_production_year2000 = Column(Float(53), nullable=False)
edgar_htap_v2_nox_emissions_year2010 = Column(Float(53), nullable=False)
omi_no2_column_years2011to2015 = Column(Float(53), nullable=False)
htap_region_tier1 = Column(Integer, nullable=False)
etopo_alt = Column(Float(53), nullable=False)
etopo_min_alt_5km = Column(Float(53), nullable=False)
etopo_relative_alt = Column(Float(53), nullable=False)
dominant_landcover_year2012 = Column(Integer, nullable=False)
toar1_category = Column(Integer, nullable=False)
# do not use string declaration here (not working for pytest)
# use the explicit class name here,
# see: https://groups.google.com/forum/#!topic/sqlalchemy/YjGhE4d6K4U
station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), nullable=False, unique=True)
#how to reactivate the following?
# station = relationship('StationmetaCore', uselist=False)