@@ -0,0 +1,1793 @@
+# -*- coding: utf-8 -*-%0Afrom sqlalchemy import (Column, Float, ForeignKey, Integer, MetaData, String,%0A                        Table, join, create_engine, ForeignKeyConstraint,%0A                        Boolean, DateTime, Sequence)%0Afrom sqlalchemy.orm import sessionmaker, relationship, configure_mappers%0A# from sqlalchemy.ext.declarative import declarative_base%0Afrom sqlalchemy.ext.automap import automap_base%0A# from geoalchemy2 import Geometry, shape%0Aimport configparser as cp%0A# from sqlalchemy.sql import func%0A# from sqlalchemy.dialects import postgresql%0Aimport os.path as path%0A%0A# read configuration file%0AFILENAME = 'config.ini'%0AFILE = path.join(path.expanduser(%22~%22), '.open_eGo', FILENAME)%0Acfg = cp.ConfigParser()%0Acfg.read(FILE)%0A%0A# establish db connection%0Asection = 'Connection'%0Aconn = create_engine(%0A    %22postgresql+psycopg2://%7Buser%7D:%7Bpassword%7D@%7Bhost%7D:%7Bport%7D/%7Bdb%7D%22.format(%0A        user=cfg.get(section, 'username'),%0A        password=cfg.get(section, 'password'),%0A        host=cfg.get(section, 'host'),%0A        port=cfg.get(section, 'port'),%0A        db=cfg.get(section, 'db')))%0A%0Aprint(%22Connected to database.%22)%0A%0A# map schema%0Asession = sessionmaker(bind=conn)()%0A%0Ameta = MetaData()%0Ameta.bind = conn%0Ameta.reflect(bind=conn, schema='calc_renpass_gis',%0A             only=%5B'renpass_gis_scenario',%0A                   'renpass_gis_linear_transformer',%0A                   'renpass_gis_source',%0A                   'renpass_gis_sink',%0A                   'renpass_gis_storage'%5D)%0A%0A# map to classes%0ABase = automap_base(metadata=meta)%0ABase.prepare()%0A%0AScenario, LinearTransformer, Source, Sink, Storage = %5C%0A    Base.classes.renpass_gis_scenario,%5C%0A    Base.classes.renpass_gis_linear_transformer,%5C%0A    Base.classes.renpass_gis_source,%5C%0A    Base.classes.renpass_gis_sink,%5C%0A    Base.classes.renpass_gis_storage%0A

Use of sqla adapter for db schema calc_renpass_gis