Hello everyone,
For me it can be considered as bug but it could be just a warning about models.
I created a model that join two table (Devices and client associated) using sql :
select
idDevice,
Client.name as clientName,
is_installed,
install_date,
from
exported_rds.device as Device
LEFT JOIN exported_rds.client AS Client ON Device.idClient = Client.idClient
notice the Client.name as clientName
, at the time I created created this model it seemed logical to rename the column.
But when I use this model in a question (using the UI query builder) using a group by it does not use "clientName" but the original name
code after inspecting the sql :
SELECT
"source"."name" AS "name",
COUNT(*) AS "count"
FROM
(
select
idDevice,
Client.name as clientName,
is_installed,
install_date,
from
exported_rds.device as Device
LEFT JOIN exported_rds.client AS Client ON Device.idClient = Client.idClient
) AS "source"
WHERE
"source"."is_installed" = 1
GROUP BY
"source"."name"
ORDER BY
"source"."name" ASC
I wanted to group the installed Device by client name but the query builder keep the orignal name of the column "source.name".
I think it is not a big deal but it can be a recommandation if you think it is normal to never rename the columns in the model.
Furthermore, renaming column in models mess with the dashboard filters depending on a table column. It produces the exact same result as this ticket (even if the cause is different):
Thank you for you opinion and help