lightdash / lightdash

Self-serve BI to 10x your data team ⚡️
https://lightdash.com
MIT License
3.8k stars 403 forks source link

Join alias with spaces breaks table calculations #10600

Open jpetey75 opened 3 months ago

jpetey75 commented 3 months ago

Description

When you join a model and use an alias that has spaces in it, the joined fields cannot be used in table calculations (it throws an error).

Steps to Reproduce the Bug or Issue

  1. add a join to a model
  2. use the alias config in the join and use a name with at least one space: alias: 'joined table'
  3. run query with a metric from the joined table and try to create a table calculation using that field
  4. the generated SQL includes part of the template syntax ${... and breaks the query

CleanShot 2024-07-03 at 13 00 10@2x

version

No response

Cloud or self-hosting

None

jpetey75 commented 3 months ago

Maybe related to this? https://github.com/lightdash/lightdash/issues/10534

ZeRego commented 3 months ago

The alias value should not have white spaces as it is used as a SQL identifier. The label property is more indicated if the user wants to rename the joined table.