Closed sutao closed 11 months ago
Hi, could you run the PRAGMA version;
query in the Metabase query editor ?
I tried almost the same
Thanks for the reply! I am running Metabase open source version v0.47.4 with DuckDB driver version 0.9.1.
Thanks!
Hey Alex,
I think I've located the problem. The error only occurs when I use a rglob pattern in the path. If I use a specific parquet file, the issue goes away. See attached screenshot.
Tao
Hey ) but in my case it works...
here is the db file structre
may be some special characters present in path
Hmmm, that's quite odd... I do not have any special characters in the path... though I do have hyphens in the UUIDs which are used as partition values... The entire stack is run in docker (with the data mapped to /dwh
)
Also, if I run the query directly without any parameters like below, it works fine.
SELECT * from read_parquet('/dwh/HourlyPowerUsageByOrg/**/*.parquet', hive_partitioning=true)
WHERE jyr=2023;
Is there any oddity in the stack trace in the initial post? It appears the query is passed into the duckdb engine without filling in the variable?
hmm... yes, indeed, looks like the query is passed into the duckdb engine without filling in the variable
here is the query i run directly in the native duckdb console app. The error is very similar to the error in the stack trace in the initial post
Here is the part of you stack trace
2023-11-29 13:38:58 {:database 2,
2023-11-29 13:38:58 :native
2023-11-29 13:38:58 {:template-tags
2023-11-29 13:38:58 {:jyr
2023-11-29 13:38:58 {:type "number", :name "jyr", :id "49a25182-c2e0-42d8-b4d0-aa1f9ff06dd9", :display-name "Jyr", :required true}},
2023-11-29 13:38:58 :query
2023-11-29 13:38:58 "SELECT * from read_parquet('/dwh/HourlyPowerUsageByOrg/**/*.parquet', hive_partitioning=true)\nWHERE jyr={{jyr}};"},
2023-11-29 13:38:58 :type "native",
2023-11-29 13:38:58 :parameters
2023-11-29 13:38:58 [{:id "49a25182-c2e0-42d8-b4d0-aa1f9ff06dd9",
2023-11-29 13:38:58 :type "number/=",
2023-11-29 13:38:58 :value ["2023"],
2023-11-29 13:38:58 :target ["variable" ["template-tag" "jyr"]]}],
2023-11-29 13:38:58 :middleware {:js-int-to-string? true, :add-default-userland-constraints? true}},
2023-11-29 13:38:58 :status :failed,
looks like variable jyr
have an internal id=49a25182-c2e0-42d8-b4d0-aa1f9ff06dd9
may be do you have the same UUID in the you data path?
i don't know how it is linked with each other but who knows :) also, it seems Metabase recognises the variable and value of variable, but in some reasons it passes the query as is into duckdb driver
I removed the org_id
partitioning, and the directory structure is re-organized as follows:
However the error still persists. And It looks like Metabase does not even fill in the parameter jyr
in Query Preview. You can see the first statement does not contain asterisks and the parameter was filled correctly (even though the parquet file does not actually exist). The second query does have asterisks and Metabase refused to fill in the parameter.
can you check the error if you type exactly this path (query)
select * from read_parquet('/my1/my2/**/*.parquet', hive_partitioning=true) where jyr={{jyr}};
The above query produced the same error. {{jyr}}
is not filled.
I think it might be an issue with Metabase. I tried the built-in Sample Database:
*Whenever there is `/` appearing in the query, the variables of that statement do not get filled.**
yes, looks like this is Metabase issue
I've got the error: IO Error: No files found that match the pattern "/my1/my2/**/*.parquet"
My Metabase: version v0.44.2, Built on 2022-08-31
Yeah, IO Error
should be the correct error, because SQL is parsed but the path is not found.
I will try 0.44.2 later on. It might be a new bug introduced by Metabase. In that case I will open an issue with Metabase.
I will try it tomorrow and update this thread (and close it) as it becomes quite late in my timezone. :-D
Thanks for your help!
Created a bug in Metabase and closing this issue. https://github.com/metabase/metabase/issues/36262
@sutao thanks! subscribed to the issue
Looks like when using variables in Metabase SQL statements, the driver returns an error:
My statement is:
In the dataset,
jyr
is a column (and hive partition) indicating the year. The following is the stack trace in metabase: