Commit 2a79bd71 authored by vidya.m's avatar vidya.m

Update pos_agg.py

parent fcaf3309
...@@ -60,15 +60,19 @@ class PostgreSQL: ...@@ -60,15 +60,19 @@ class PostgreSQL:
except Exception as e: except Exception as e:
print(e, "failed to update the data") print(e, "failed to update the data")
@staticmethod @staticmethod
def fetch_data(): def fetch_data():
try: try:
student_data = session.query(student).all() fetch_data = SqlUtility.fetch_file()
list_ = [] header_label = [" ".join(col.split("_")).title() for col in student.__table__.columns.keys()]
for data in student_data: header_value = list(student.__table__.columns.keys())
list_.append(
{"student_id": data.student_id, "student_name": data.student_name, "desciption": data.description, header = [{"label": label, "value": value} for label, value in zip(header_label, header_value)]
"address": data.address})
return list_ response = {
"header": header,
"body content": fetch_data
}
return response
except Exception as e: except Exception as e:
print(e, "Failed to Find the data") print(e, "failed to find the data")
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment