lightdash icon indicating copy to clipboard operation
lightdash copied to clipboard

Column names should be wrapped in quotes

Open ZeRego opened this issue 3 years ago • 3 comments

Description

Lightdash doesn't respect the columns that are case sensitive. Eg. in a postges table I have the column "Region" but when queried via Lightdash is trying to get "region". Resulting in the following error: 1

To Reproduce

SQL Lightdash generates

SELECT
  "new_demo_data".Region AS "new_demo_data_Region",
  AVG("new_demo_data".Profit) AS "new_demo_data_average_of_profit"
FROM "postgres"."dbt_lightdash"."new_demo_data" AS "new_demo_data"


GROUP BY 1
ORDER BY "new_demo_data_average_of_profit" DESC
LIMIT 500

SQL it should generate:

SELECT
  "new_demo_data"."Region" AS "new_demo_data_Region",
  AVG("new_demo_data"."Profit") AS "new_demo_data_average_of_profit"
FROM "postgres"."dbt_lightdash"."new_demo_data" AS "new_demo_data"


GROUP BY 1
ORDER BY "new_demo_data_average_of_profit" DESC
LIMIT 500

App Version

0.251.2

ZeRego avatar Sep 13 '22 13:09 ZeRego

Should we use the dbt quoting config to decide if we should wrap in quotes or not ?

ZeRego avatar Sep 13 '22 13:09 ZeRego

Another option is to let them handle this by using sql on their schema. It does not require any change. /cc @TuringLovesDeathMetal @owlas

Screenshot from 2022-09-21 11-30-45

image

rephus avatar Sep 21 '22 09:09 rephus

Another option is to let them handle this by using sql on their schema.

Don't love this option - it feels a bit broken that it doesn't "just work" for my columns (even if some of them are upper case)

TuringLovesDeathMetal avatar Sep 21 '22 13:09 TuringLovesDeathMetal

:tada: This issue has been resolved in version 0.272.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Oct 03 '22 14:10 github-actions[bot]