ToucanToco / weaverbird

A visual data pipeline builder with various backends
https://weaverbird.toucantoco.dev
BSD 3-Clause "New" or "Revised" License
97 stars 17 forks source link

fix(server): prevent custom SQL queries finishing with comments to fail #2230

Closed davinov closed 1 month ago

davinov commented 1 month ago

As noticed by @ThGa-Droid , custom queries that ended with comments failed. That's because we are encapsulating them like this:

WITH __step_0_googlebigquerytranslator__ AS (SELECT
  *
FROM `something`
  -- some comment) SELECT * FROM `__step_0_googlebigquerytranslator__` LIMIT 50

which cases the last line to be ignored.

To avoid this, I suggest we add a new line to all custom queries, like:

WITH __step_0_googlebigquerytranslator__ AS (SELECT
  *
FROM `something`
  -- some comment
) SELECT * FROM `__step_0_googlebigquerytranslator__` LIMIT 50