hv-service/Wohnungen.py

25 lines
595 B
Python
Raw Normal View History

from dbpool import getConnection, getOne, getMany
2021-01-16 19:47:34 +01:00
def get_wohnungen():
return getMany("""
2021-01-16 19:47:34 +01:00
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
2021-01-17 14:45:11 +01:00
""", [], "Wohnung")
2021-01-16 19:47:34 +01:00
def get_wohnung(id=None):
return getOne("""
2021-01-16 19:47:34 +01:00
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")