Hi all, I have fields that are ENUM in the databas...
# gooddata-cloud
g
Hi all, I have fields that are ENUM in the database, is there a way to MAP the integer to a string (it is a fixed mapping) ? I only found that I can do it in the LDM and map the table to SQL table and do it via SQL query. Is there another way?
j
Hi Goran, I believe that using the SQL query is currently the best feasible workaround as we do not support ENUM type directly. You can found our supported data types here: https://www.gooddata.com/docs/cloud/model-data/prepare-your-data/#PrepareYourData-SupportedDataTypes
Another thing I could think of would be to create a small lookup table in your database that maps the enum values, for example mapping
status_id = 1
to
status_label = 'Active'
. You would then load this table as a separate dataset in the LDM and create a relationship from your main table’s
status
column to the lookup table’s
status_id
. This way, the descriptive label (
status_label
) is defined only once and can be reused for different datasets without duplicating it. However, you would need to test this approach to make sure it fits your data structure and performance needs. Let me know if you wish me to create a product feedback on your behalf regarding ENUM type.
g
Hi @Julius Kos Thanks for the reply. We are currently using lookup tables for this, but we wanted to reduce join operations, so I wanted to try and map them directly in the table. Since SQL is the best way, I will try this on all the other tables. Thanks
1