|
18 | 18 | from starlette.responses import PlainTextResponse |
19 | 19 |
|
20 | 20 | from mcp_clickhouse.mcp_env import get_config, get_all_configs, get_mcp_server_config, get_chdb_config |
21 | | - |
22 | | -# chDB prompt content |
23 | | -CHDB_PROMPT = """ |
24 | | -chDB is an in-process SQL OLAP Engine powered by ClickHouse. |
25 | | -
|
26 | | -Features: |
27 | | -- Fast columnar data processing |
28 | | -- Standard SQL support |
29 | | -- No need for a separate server |
30 | | -- Supports various data formats (CSV, JSON, Parquet, etc.) |
31 | | -- Can work with local files and remote data sources |
32 | | -
|
33 | | -Common usage patterns: |
34 | | -
|
35 | | -1. Basic query: |
36 | | - SELECT * FROM table LIMIT 10 |
37 | | -
|
38 | | -2. Working with CSV data: |
39 | | - SELECT * FROM file('data.csv', 'CSV', 'col1 String, col2 Int32') |
40 | | -
|
41 | | -3. Aggregations: |
42 | | - SELECT count(), avg(column_name) FROM table |
43 | | -
|
44 | | -4. Data analysis: |
45 | | - SELECT |
46 | | - column1, |
47 | | - count() as count, |
48 | | - sum(column2) as total |
49 | | - FROM table |
50 | | - GROUP BY column1 |
51 | | - ORDER BY count DESC |
52 | | -
|
53 | | -5. Time series analysis: |
54 | | - SELECT |
55 | | - toDate(timestamp) as date, |
56 | | - count() as events |
57 | | - FROM table |
58 | | - GROUP BY date |
59 | | - ORDER BY date |
60 | | -
|
61 | | -Tips: |
62 | | -- Use LIMIT for large datasets to avoid overwhelming output |
63 | | -- Leverage ClickHouse's built-in functions for data processing |
64 | | -- chDB supports most ClickHouse SQL features |
65 | | -- Data types are automatically inferred when possible |
66 | | -- Use proper column types for better performance |
67 | | -
|
68 | | -For more complex queries, refer to ClickHouse documentation as chDB is compatible with ClickHouse SQL syntax. |
69 | | -""" |
| 21 | +from mcp_clickhouse.chdb_prompt import CHDB_PROMPT |
70 | 22 |
|
71 | 23 |
|
72 | 24 | @dataclass |
|
0 commit comments