Canner / WrenAI

🚀 Open-source SQL AI Agent for Text-to-SQL. Make Text2SQL Easy! 🙌
https://www.getwren.ai/oss
GNU Affero General Public License v3.0
1.67k stars 146 forks source link

[Query][Clickhouse] failed to fetch data successfully/follow instructions #522

Open dacozai opened 1 month ago

dacozai commented 1 month ago

Environment Information

  1. OS: Ubuntu 24.04 LTS
  2. Browser: Chrome Version 126.0.6478.126 (Official Build) (64-bit)
  3. Clickhouse server: 24.2.2 Clickhouse cloud

Bug Illustration

There are two issues for the generated SQL statements

  1. failed to query other table
  2. using not empty function incorrectly

Detals -- TL;DR

  1. Failed to query data on Clickhouse. The statement is clear I suppose but it got stuck in query the last fetched table -- eth_lgos as you can see in logs. I already changed to query the other table - token_tsrf - but the query statement got stuck somehow. Moreover, the schema got stuck as well.
  2. Obviously, I want to find notEmpty(token_id) instead of token_id IS NULL. I think the type function did not be integrated into the SQL statement [notEmpty reference]. Although Clickhouse query statement is very similar to SQL, it is still different in its useful functions. It's awesome of it can be integrated into the AI generated statement.

Screenshot

Screenshot from 2024-07-16 12-38-49

Logs

attached in DM

Additional context

None

wwwy3y3 commented 1 month ago

Status update @dacozai : @onlyjackfrost is checking this issue. We'll follow-up our update on this issue.

onlyjackfrost commented 1 month ago

Hi @dacozai I found that you've deployed your model when server started, But there is no token_tsrf model in your model, only prod_eth_logs. That is the reason you couldn't get answers from Wren AI. Can you update to the latest version, create and deploy the model, and then try again?

wwwy3y3 commented 1 month ago

@dacozai FYI, you could create a model following instructions here: https://docs.getwren.ai/guide/modeling/models