starburstdata / metabase-driver

Starburst Metabase driver
Apache License 2.0
65 stars 10 forks source link

Can not query if we call a parameter in commented query #95

Closed rafifas closed 1 year ago

rafifas commented 1 year ago

When running the following query:

--     SELECT *    
--     FROM    
--         table_a
--     WHERE
--        date = {{period}}

SELECT *    
FROM    
table_b
WHERE
date = {{period}}

I got an error saying:

line 1:1: Incorrect number of parameters: expected 1 but found 3

Even though when we run it using presto driver, the query is running successfully.

If we delete the line:

--        date = {{period}}

from the query, it will run successfully in the Starburst driver. another case when adding parameters in the comment section of the query such as:

--     SELECT *    
--     FROM    
--         table_a
--     WHERE
--        date = {{period}}
--        and id = {{ID}}

SELECT *    
FROM    
table_b
WHERE
date = {{period}}

it will return with error: line 1:1: Incorrect number of parameters: expected 1 but found 5

It seems that the driver counts each parameter in the comment section as 2 parameters.

We use Starburst driver version 2.0.1 and Metabase version v0.45.2.1. Is it expected or is there any release that fixes this issue? Thanks in advance!

lpoulain commented 1 year ago

I've tried to reproduce the issue using the latest Starburst driver and Metabase v0.46 but this works for me. Does this happen only with the Starburst driver or other drivers as well?

paoliniluis commented 1 year ago

@rafifas please upgrade to the latest version, I think we fixed that in the most recent versions