Renaming columns in queries #1728
-
My request is: https://localhost:5001/api/Product?$select=fpartno,frev,fdescript. I would like to rename the columns to more meaningful names. In SQL it was Select PartNo=fpartno, Revision=frev, ... Can I do that with Rest\DAB? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @BumpaRoy, You can add column mappings (aliases) to your database columns to give more friendly names. See https://learn.microsoft.com/azure/data-api-builder/configuration-file#mappings For each entity in your runtime config, you can add a mappings section like so, where the format is "mappings": {
"fpartno": "PartNo",
"frev": "Revision"
} The mappings will apply to both GraphQL and REST endpoints. |
Beta Was this translation helpful? Give feedback.
Hi @BumpaRoy,
You can add column mappings (aliases) to your database columns to give more friendly names. See https://learn.microsoft.com/azure/data-api-builder/configuration-file#mappings
For each entity in your runtime config, you can add a mappings section like so, where the format is
"db_column_name": "Alias"
The mappings will apply to both GraphQL and REST endpoints.