goz.py

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
class ProjCostReView(RestHandlerView):
store = project_cost_store
def collection_get(self):
result = []
terms = [
and_(ConstructionObjectInfo.id == PerformedWorkCost.construction_object_info_id,
ConstructionObjectInfo.id == ProjectCost.construction_object_info_id)
]
join = outerjoin(ProjectCost, PerformedWorkCost, ProjectCost.id == PerformedWorkCost.construction_object_info_id)
s = select([ConstructionObjectInfo, ProjectCost, PerformedWorkCost]).where(
*terms
).apply_labels()
for row in conn.execute(s):
rec = dict(zip(row.keys(), row))
rec['id'] = rec['construction_object_info_id']
result.append(rec)
return result