More readable SQL

When generating its SQL, holistics generates apparently random column name aliases

e.g.
select
“afp_activation”.“CUSTOMER_ID” AS “aa_ci_c8cd07

Why could it not just use the name of the column, given that it would be easier to read downstream, when getting into complex visualisation?

Hi @Alex_H ,

I do agree that the auto generate alias for column is not very readable and easy for you to debug when issues happen.
The reason we use these aliases in the first place because we want to ensure that the columns with same name (but in different models) will not cause errors in the downstream queries.

We could do something like model_name_column_name but the identifier in the databases has character limit so the expected name (model_name_column_name) might be truncated which consequently causes error in the query.

What we have done is using the short-form of the field name constructed by the first letters of the model name and field name.
For example, your field name is aft_activation_customer_id so the short-form will be aa_ci

Actually, we can improve this behavior by only applying the short-form if field name only if its name is too long.
I will note this down for future improvement.

Thanks for the feedback Alex

1 Like

model_name_column_name and only shortening where necessary sounds like a good solution, thanks!