giving alias while fetching data using sqlalchemy in fastapi

Viewed 18

Here is my code using fastapi and sqlalchemy

 detailsQ =(
        session.query(
            Cloud.id ,Cloud.code,ResourceType.short_name,ActionType.short_name 
            )
            .all()
    )
return d

Now I am getting only :

  {
    "id": 4,
    "code": "ALB",
    "short_name": "ANSIBLE_TOWER"
  },

How to add alias so that I will get all data in response body...?

0 Answers
Related