Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] [dashboard] 'ClickhouseConnector' object has no attribute 'session' #1493

Open
3 of 15 tasks
chenminwei1984 opened this issue May 7, 2024 · 2 comments
Open
3 of 15 tasks
Labels
bug Something isn't working Waiting for reply

Comments

@chenminwei1984
Copy link

Search before asking

  • I had searched in the issues and found no similar issues.

Operating system information

Linux

Python version information

3.10

DB-GPT version

main

Related scenes

  • Chat Data
  • Chat Excel
  • Chat DB
  • Chat Knowledge
  • Model Management
  • Dashboard
  • Plugins

Installation Information

Device information

local openai api

Models information

llam3

What happened

Use the dashboard to query clickhouse

clean prompt response: [{ "sql": "SELECT country, port, bandwidth, outmax FROM traffic_data ORDER BY outmax DESC LIMIT 3", "title": "Top 3 Highest Traffic Ports by Country", "showcase": "BarChart", "thoughts": "This SQL query selects the country, port, bandwidth, and the maximum output traffic for the top three ports with the highest output traffic from the 'traffic_data' table. A BarChart is chosen to visually compare the traffic across different countries and ports." }]
2024-05-07 15:00:38 pnma-ck dbgpt.datasource.rdbms.base[26170] INFO Query[SELECT country, port, bandwidth, outmax FROM traffic_data ORDER BY outmax DESC LIMIT 3]
'ClickhouseConnector' object has no attribute 'session'

What you expected to happen

'ClickhouseConnector' object has no attribute 'session'

How to reproduce

Use the dashboard to query clickhouse
ClickHouse client version 22.1.3.7 (official build).
DBGPT 5.5

Additional context

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!
@chenminwei1984 chenminwei1984 added bug Something isn't working Waiting for reply labels May 7, 2024
@chenminwei1984
Copy link
Author

I installed the new clickhouse test (24.4.1.2088),used the agent query, and after a few automatic retries, it returned a normal result.

2024-05-07 15:37:08 pnma-ck dbgpt.agent.expand.data_scientist_agent[38979] ERROR DataScientist check exception!'ClickhouseConnector'object has no attribute 'session'
Traceback (most recent call last):
File "/app/DB-GPT/dbgpt/agent/expand/data_scientist_agent.py", line 110, in correctness_check
columns, values = await resource_db_client.query(
File "/app/DB-GPT/dbgpt/serve/agent/resource_loader/datasource_load_client.py", line 62, in query
return conn.query_ex(sql)
File "/app/DB-GPT/dbgpt/datasource/rdbms/base.py", line 356, in query_ex
cursor = self.session.execute(text(query))
AttributeError: 'ClickhouseConnector' object has no attribute 'session'


Edgar (to PlanManager)-[chatgpt_proxyllm]:

"{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}"

Edgar Review info:
Pass(None)
Edgar Action report:
execution succeeded,
{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL��句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}


2024-05-07 15:37:08 pnma-ck dbgpt.datasource.manages.connect_config_db[38979] INFO Result: <sqlalchemy.engine.cursor.CursorResult object at 0x7f22783f0dc0>


PlanManager (to Edgar)-[]:

"SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'"


2024-05-07 15:37:08 pnma-ck dbgpt.agent.core.base_agent[38979] INFO _a_select_llm_model:None
2024-05-07 15:37:08 pnma-ck dbgpt.agent.core.llm.llm_client[38979] INFO Request:
{'model': 'chatgpt_proxyllm', 'prompt': None, 'messages': [{'content': 'You are a DataScientist,named Edgar,your goal is Use correct clickhouse SQL to analyze and solve tasks based on the data structure information of the database given in the resource.\nPlease thinkstep by step to achieve the goal. You can use the resources given below. At the same time, please strictly abide by the constraints and specifications in IMPORTANT REMINDER.\n\nRESOURCES:clickhouse --['bgp_lax2_old_csv(name-dashboard-rowname-country-panelname-device-port-type-isp-bandwidth-highspeed-inid-outid-clock-inmax-outmax-outavg-inavg-inpercent-outpercent)']\n\n\n\n*** IMPORTANT REMINDER ***\nPlease answer in simplified Chinese.\n1. Please check the generated SQL carefully. Please strictly abide by the data structure definition given. It is prohibited to use non-existent fields and data values. Do not use fields from table A to table B. You can perform multi-table related queries.\n2. If the data and fields that need to be analyzed in the target are in different tables, it is recommended to use multi-table correlation queries first, and pay attention to the correlation between multiple table structures.\n3. It is forbidden to construct data by yourself as a query condition. If you want to query a specific field, if the value of the field is provided, then you can perform a group statistical query on the field.\n4. Please select an appropriate one from the supported display methods for data display. If no suitable display type is found, table display is used by default. Supported display types: \n response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable forexploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of timeseries data, large-scale data sets, distribution of classified data, etc.\n\n\nPlease response in the following json format:\n {\n "display_type": "The chart rendering method selected for SQL. If you don’t know what to output, just output 'response_table' uniformly.",\n "sql": "Executable sql generated for the current target/problem",\n "thought": "Summary of thoughts to the user"\n}\n Make sure the response is correct json and can be parsed by Python json.loads.\n ', 'role': 'system'}, {'content': "执行SQL查询,选取'port'列中的最大三个值。", 'context': {'plan_task': "执行SQL查询,选取'port'列中���最大三个值。", 'plan_task_num': 1}, 'role': 'human'}, {'content': '{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"根据要求,我编写了一个SQL查询,该查询从'bgp_lax2_old_csv'表中选择'port'列,并按照降序排列,然后选取前三个最大值。结果将以表格形式展示。"}', 'context': {'display_type': 'response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.', 'dialect': 'clickhouse'}, 'role': 'ai'}, {'content': "SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'", 'context': {'display_type': 'response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time seriesdata, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.', 'dialect': 'clickhouse'}, 'role': 'human'}, {'content': '{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}', 'context': {'display_type': 'response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time seriesdata, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.', 'dialect': 'clickhouse'}, 'role': 'ai'}, {'content': "SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'", 'role': 'human'}], 'temperature': 0.5, 'max_new_tokens': 1024, 'echo': False}
2024-05-07 15:37:08 pnma-ck dbgpt.model.adapter.base[38979] INFO Message version is v2
2024-05-07 15:37:08 pnma-ck dbgpt.model.cluster.worker.default_worker[38979] INFO current generate stream function is asynchronous stream function
llm_adapter:

model prompt:

system: You are a DataScientist,named Edgar,your goal is Use correct clickhouse SQL to analyze and solve tasks based on the data structure information of the database given in the resource.
Please think step by step to achieve the goal. You can use the resources given below. At the same time, please strictly abide by the constraints and specifications in IMPORTANT REMINDER.

RESOURCES:clickhouse --['bgp_lax2_old_csv(name-dashboard-rowname-country-panelname-device-port-type-isp-bandwidth-highspeed-inid-outid-clock-inmax-outmax-outavg-inavg-inpercent-outpercent)']

*** IMPORTANT REMINDER ***
Please answer in simplified Chinese.

  1. Please check the generated SQL carefully. Please strictly abide by the data structure definition given. It is prohibited to use non-existent fields and data values. Do not use fields from table A to table B. You can perform multi-table related queries.
  2. If the data and fields that need to be analyzed in the target are in different tables, it is recommended to use multi-table correlation queries first, and pay attention to the correlation between multiple table structures.
  3. It is forbidden to construct data by yourself as a query condition. If you want to query a specific field, if the value of the field is provided, then you can perform a group statistical query on the field.
  4. Please select an appropriate one from the supported display methods for data display. If no suitable display type is found, table display is used by default. Supported display types:
    response_line_chart:used to display comparative trend analysis data
    response_pie_chart:suitable for scenarios such as proportion and distribution statistics
    response_table:suitable for display with many display columns or non-numeric columns
    response_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.
    response_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.
    response_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories,etc.
    response_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.
    response_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.

Please response in the following json format:
{
"display_type": "The chart rendering method selected for SQL. If you don’t know what to output, just output 'response_table' uniformly.",
"sql": "Executable sql generated for the current target/problem",
"thought": "Summary of thoughts to the user"
}
Make sure the response is correct json and can be parsed by Python json.loads.

human: 执行SQL查询,选取'port'列中的最大三个值。
ai: {"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"根据要求,我编写了一个SQL查询,该查询从'bgp_lax2_old_csv'表中选择'port'列,并按照降序排列,然后选取前三个最大值。结果将以表格形式展示。"}
human: SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'
ai: {"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}
human: SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'

async stream output:

2024-05-07 15:37:08 pnma-ck dbgpt.model.proxy.llms.chatgpt[38979] INFO Send request to openai(1.25.2), payload: {'stream': True, 'model': 'mixtral-8x7b', 'temperature': 0.5, 'max_tokens': 1024}

messages:
[{'role': 'system', 'content': 'You are a DataScientist,named Edgar,your goal is Use correct clickhouse SQL to analyze and solve tasks based on the data structure information of the database given in the resource.\nPlease think step by step to achieve the goal. You can use the resources given below. At the same time, please strictly abide by the constraints and specifications in IMPORTANT REMINDER.\n\nRESOURCES:clickhouse --['bgp_lax2_old_csv(name-dashboard-rowname-country-panelname-device-port-type-isp-bandwidth-highspeed-inid-outid-clock-inmax-outmax-outavg-inavg-inpercent-outpercent)']\n\n\n\n*** IMPORTANT REMINDER ***\nPlease answer in simplified Chinese.\n1. Please check the generated SQL carefully. Please strictly abide by the data structure definition given. It is prohibited to use non-existent fields and data values. Do not use fields from table A to table B. You can perform multi-table related queries.\n2. If the data and fields that need to be analyzed in the target are in different tables, it is recommended to use multi-table correlation queries first, and pay attention to the correlation between multiple table structures.\n3. It is forbidden to construct data by yourself as a query condition. If you want to query a specific field, if the value of the field is provided, then you can perform a group statistical query on the field.\n4. Please select an appropriate one from the supported display methods for data display. If no suitable display type is found, table display is used by default. Supported display types: \n response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.\n\n\nPlease response in the following json format:\n {\n "display_type": "The chart rendering method selected for SQL. If you don’t know what to output, just output 'response_table' uniformly.",\n "sql": "Executable sql generated for the current target/problem",\n "thought": "Summary of thoughts to the user"\n}\n Make sure the response is correct json and can be parsed by Python json.loads.\n '}, {'role': 'user', 'content': "执行SQL查询,选取'port'列中的最大三个值。"}, {'role': 'assistant', 'content': '{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"根据要求,我编写了一个SQL查询,该查询从'bgp_lax2_old_csv'表中选择'port'列,并按照降序排列,然后选取前三个最大值。结果将以表格形式展示。"}'}, {'role': 'user', 'content': "SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'"}, {'role': 'assistant', 'content': '{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或���法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}'}, {'role': 'user', 'content': "SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'"}]
{"2024-05-07 15:37:09 pnma-ck dbgpt.model.cluster.worker.default_worker[38979] INFO is_first_generate, usage: None
display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保使用正确的库方法或上下文执行此SQL。"}

full stream output:
{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保使用正确的库方法或上下文执行此SQL。"}

model generate_stream params:
{'model': 'chatgpt_proxyllm', 'messages': [ModelMessage(role='system', content='You are a DataScientist,named Edgar,your goal is Use correct clickhouse SQL to analyze and solve tasks based on the data structure information of the database given in the resource.\nPlease think step by step to achieve the goal. You can use the resources given below. At the same time, please strictly abide by the constraints and specifications in IMPORTANT REMINDER.\n\nRESOURCES:clickhouse --['bgp_lax2_old_csv(name-dashboard-rowname-country-panelname-device-port-type-isp-bandwidth-highspeed-inid-outid-clock-inmax-outmax-outavg-inavg-inpercent-outpercent)']\n\n\n\n*** IMPORTANT REMINDER \nPlease answer in simplified Chinese.\n1. Please check the generated SQL carefully. Please strictly abide by the data structure definition given. It is prohibited to use non-existent fields and data values. Do not use fields from table A to table B. You can perform multi-table related queries.\n2. If the data and fields that need to be analyzed in the target are in different tables, it is recommended to use multi-table correlation queries first, and pay attention to the correlation between multiple table structures.\n3. It is forbidden to construct data by yourself as a query condition. If you want to query a specific field, if the value of the fieldis provided, then you can perform a group statistical query on the field.\n4. Please select an appropriate one from the supported display methods for data display. If no suitable display type is found, table display is used by default. Supported display types: \n response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships betweenmultiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportion display and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysisof time series data, large-scale data sets, distribution of classified data, etc.\n\n\nPlease response in the following json format:\n {\n "display_type": "The chart rendering method selected for SQL. If you don’t know what to output, just output 'response_table' uniformly.",\n "sql": "Executable sql generated for the current target/problem",\n "thought": "Summary of thoughts to theuser"\n}\n Make sure the response is correct json and can be parsed by Python json.loads.\n ', round_index=0), ModelMessage(role='human', content="执行SQL查询,选取'port'列中的最大三个值。", round_index=0), ModelMessage(role='ai', content='{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"根据要求,我编写了一个SQL查询,该查询从'bgp_lax2_old_csv'表中选择'port'列,并按照降序排列,然后选取前三个最大值。结果将以表格形式展示。"}', round_index=0), ModelMessage(role='human', content="SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'", round_index=0), ModelMessage(role='ai', content='{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}', round_index=0), ModelMessage(role='human', content="SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'", round_index=0)], 'temperature': 0.5, 'max_new_tokens': 1024, 'echo': False, 'span_id': '85b3817a-68bf-4f0c-b4a4-1ba853e0c15e:c3747402-06f1-47fa-ac7c-2f718615e842', 'context': {'stream': False, 'cache_enable': False, 'user_name': None, 'sys_code': None, 'conv_uid': None, 'span_id': None, 'chat_mode': None, 'chat_param': None, 'extra': {}, 'request_id': None}, 'convert_to_compatible_format': False, 'string_prompt': 'system: You are a DataScientist,named Edgar,your goal is Use correct clickhouse SQL to analyze and solve tasks based on the data structure information of the database given in the resource.\nPlease think step by step to achieve the goal. You can use the resources given below. At the same time, please strictly abide by the constraints and specifications in IMPORTANT REMINDER.\n\nRESOURCES:clickhouse --['bgp_lax2_old_csv(name-dashboard-rowname-country-panelname-device-port-type-isp-bandwidth-highspeed-inid-outid-clock-inmax-outmax-outavg-inavg-inpercent-outpercent)']\n\n\n\n IMPORTANT REMINDER ***\nPlease answer in simplified Chinese.\n1. Please check the generated SQL carefully. Please strictly abide by the data structure definition given. It is prohibited to use non-existent fields and data values. Do not use fields from table A to table B. You can perform multi-table related queries.\n2. If the data and fields that need to be analyzed in the target are in different tables, it is recommended to use multi-table correlation queries first, and pay attention to the correlation between multiple table structures.\n3. It is forbidden to constructdata by yourself as a query condition. If you want to query a specific field, if the value of the field is provided, then you can perform a group statistical query on the field.\n4. Please select an appropriate one from the supported display methods for data display.If no suitable display type is found, table display is used by default. Supported display types: \n response_line_chart:used to display comparative trend analysis data\nresponse_pie_chart:suitable for scenarios such as proportion and distribution statistics\nresponse_table:suitable for display with many display columns or non-numeric columns\nresponse_scatter_plot:Suitable for exploring relationships between variables, detecting outliers, etc.\nresponse_bubble_chart:Suitable for relationships between multiple variables, highlighting outliers or special situations, etc.\nresponse_donut_chart:Suitable for hierarchical structure representation, category proportiondisplay and highlighting key categories, etc.\nresponse_area_chart:Suitable for visualization of time series data, comparison of multiple groups of data, analysis of data change trends, etc.\nresponse_heatmap:Suitable for visual analysis of time series data, large-scale data sets, distribution of classified data, etc.\n\n\nPlease response in the following json format:\n {\n "display_type": "The chart rendering method selected for SQL. If you don’t know what to output, just output 'response_table' uniformly.",\n "sql": "Executable sql generated for the current target/problem",\n "thought": "Summary of thoughts to the user"\n}\n Make sure the response is correct json and can be parsed by Python json.loads.\n \nhuman: 执行SQL查询,选取'port'列中的最大三个值。\nai:{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"根据要求,我编写了一个SQL查询,该查询从'bgp_lax2_old_csv'表中选择'port'列,并按照降序排列,然后选取前三个最大值。结果将以表格形式展示。"}\nhuman: SQLexecution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session'\nai: {"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"错误信息与SQL语句本身无关,它指出的是执行环境或库的问题,即'ClickhouseConnector'对象缺少执行SQL的'session'属性。确保使用正确的上下文或方法来执行SQL。此SQL语句正确,旨在从'bgp_lax2_old_csv'表中获取'port'列的前三大的值,并以表格形式展示。"}\nhuman: SQL execution error, please re-read the historical information to fix this SQL. The error message is as follows:'ClickhouseConnector' object has no attribute 'session''}
un_stream ai response: {"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保使用正确的库方法或上下文执行此SQL。"}
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.manages.connect_config_db[38979] INFO Result: <sqlalchemy.engine.cursor.CursorResult object at 0x7f225dc2f040>
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.rdbms.conn_clickhouse[38979] INFO SQL:SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.rdbms.conn_clickhouse[38979] INFO SQL:SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3, ttype:Token.Keyword.DML, sql_type:SELECT, table:None
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.rdbms.conn_clickhouse[38979] INFO Query[SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3]
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.manages.connect_config_db[38979] INFO Result: <sqlalchemy.engine.cursor.CursorResult object at 0x7f228df8e920>
2024-05-07 15:37:15 pnma-ck dbgpt.datasource.rdbms.base[38979] INFO Query[SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3]
2024-05-07 15:37:15 pnma-ck dbgpt.agent.expand.data_scientist_agent[38979] ERROR DataScientist check exception!'ClickhouseConnector'object has no attribute 'session'
Traceback (most recent call last):
File "/app/DB-GPT/dbgpt/agent/expand/data_scientist_agent.py", line 110, in correctness_check
columns, values = await resource_db_client.query(
File "/app/DB-GPT/dbgpt/serve/agent/resource_loader/datasource_load_client.py", line 62, in query
return conn.query_ex(sql)
File "/app/DB-GPT/dbgpt/datasource/rdbms/base.py", line 356, in query_ex
cursor = self.session.execute(text(query))
AttributeError: 'ClickhouseConnector' object has no attribute 'session'


Edgar (to PlanManager)-[chatgpt_proxyllm]:

"{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保使用正确的库方法或上下文执行此SQL。"}"

Edgar Review info:
Pass(None)
Edgar Action report:
execution succeeded,
{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保��用正确的库方法或上下文执行此SQL。"}



PlanManager (to User)-[]:

"查询最大的三个端口"

PlanManager Review info:
Pass(None)
PlanManager Action report:
execution failed,
{"display_type":"response_table","sql":"SELECT port FROM bgp_lax2_old_csv ORDER BY port DESC LIMIT 3","thought":"尽管有提到'ClickhouseConnector'对象缺少'session'属性的错误,这实际上是一个执行环境问题而非SQL语法问题。SQL本身是正确的,旨在查询'bgp_lax2_old_csv'表中'port'列的前三个最大值。请确保使用正确的库方法或上下文执行此SQL。"}


2024-05-07 15:37:15 pnma-ck dbgpt.serve.agent.agents.controller[38979] INFO save agent chat info!82c5c98e-0c44-11ef-8715-a0369fa9eae0

@mieco
Copy link

mieco commented May 28, 2024

it looks the __init__ function in ClickhouseConnector didn't set the session attribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Waiting for reply
Projects
None yet
Development

No branches or pull requests

2 participants