I have integrated Metabase with MonetDB by writing its driver.
But while creating a question with an aggregate and group by, it fails:
Sample query:
select
""."
"."tableCode" as "tableCode",
COUNT(*) as "count"
from
""."
"
group by
""."
"."tableCode"
order by
""."
"."tableCode" asc;
Error is:
SELECT: cannot use non GROUP BY column '
.tableCode' in query results without an aggregate function",:row_count 0,
The reason for this error is that it is generating query with alias of table name.
Correct query should be like:
select
"x"."tableCode" as "tableCode",
COUNT(*) as "count"
from
""."
"
group by
"x"."tableCode"
order by
"x"."tableCode" asc;
Other databases like postgres support this query without alias but Monetdb doesnt.
Due to this limitation we need to convert the question to native sql query.
is there a way to fix this may be by some implementing some multimethod in our driver
Reposting the question as it has syntax issues
I have integrated Metabase with MonetDB by writing its driver.
But while creating a question with an aggregate and group by, it fails:
Sample query:
select
"<schema>"."<table>"."tableCode" as "tableCode",
COUNT(*) as "count"
from
"<schema>"."<table>"
group by
"<schema>"."<table>"."tableCode"
order by
"<schema>"."<table>"."tableCode" asc;
Error is:
SELECT: cannot use non GROUP BY column '
.tableCode' in query results without an aggregate function",:row_count 0,
The reason for this error is that it is generating query with alias of table name.
Correct query should be like:
select
"x"."tableCode" as "tableCode",
COUNT(*) as "count"
from
"<schema>"."<table>"
group by
"x"."tableCode"
order by
"x"."tableCode" asc;
Other databases like postgres support this query without alias but Monetdb doesnt.
Due to this limitation we need to convert the question to native sql query.
is there a way to fix this may be by some implementing some multimethod in our driver