Closed davideanastasia closed 4 years ago
Assuming you're talking about renaming a column under Data Model and then not being able to reference it by its stable database name? That makes sense, it's a reasonable change.
Another benefit is that it cuts down on API requests for the initial lookup tables (currently, separate for tables and fields).
I suggest to use /api/database/{id}/metadata instead of /api/database/{id}/fields.
Currently, the code is leveraging the /fields API to retrieve field metadata. However, the response I am getting is like:
{ "id": 39, "name": "Companies House No", "base_type": "type/Text", "special_type": null, "table_name": "Dim Account", "schema": null }
with no stable identifier for the field name (name field is basically the display name in Metabase).
I suggest to use the /metadata API instead, which will return a nested json of tables and fields, where a field will look like:
{ "description": null, "database_type": "STRING", "special_type": "type/Company", "display_name": "Company Number", "base_type": "type/Text", }
(I have summarised the response, which is a lot larger). I'd be happy to implement this change.