from dbpool import getConnection, getOne, getMany def get_wohnungen(): return getMany(""" SELECT w.id as id, w.objekt as objekt_id, w.shortname as wohnung, w.flaeche as flaeche, o.shortname as objekt FROM wohnung w, objekt o WHERE o.id = w.objekt """, [], "Wohnung") def get_wohnung(id=None): return getOne(""" SELECT w.id as id, w.objekt as objekt_id, w.shortname as wohnung, w.flaeche as flaeche, o.shortname as objekt FROM wohnung w, objekt o WHERE o.id = w.objekt AND w.id = ? """, (id, ), "Wohnung")