Connection Pool

Introduction #

Data sources (connection pools) are the bridge between SmartChart and databases. Once created, all datasets can reuse the connection, supporting MySQL, PostgreSQL, Oracle, ClickHouse, and 30+ other databases, as well as special data sources (API, Python, Redis, etc.).

How to Add a Data Source #

  • In development mode, click “Dev Management” -> Data Source -> Add

  • Configure connection pool parameters, select a driver. For custom drivers, type the driver name and press Enter

Screenshot

  • You can test connectivity by creating a new dataset
  • After clicking “Save”, return to the dataset list and click the right-side menu to enter the dataset development interface

Security Control #

  • You can set security controls in “Parameters” to prevent user errors from causing frontend/backend freezes Screenshot
  • limit: Limits the maximum number of returned rows (actual database queries are not limited, use mode to control)
  • mode: Controls user query behavior, default is mode 1
Mode Name Preview Injection Query Injection
0 Strict Mode Y Y
1 Development Mode Y N
2 Relaxed Mode N N

For MPP databases like StarRocks, Impala, etc., if injection is Y, it may affect sorting

Supported Data Sources #

Database Driver Install Notes
MySQL mysql Built-in
MySQL Pool mysqlpool pip install DBUtils
SQLite sqlite Built-in Use absolute path for connection address
DuckDB duckdb pip install duckdb Use absolute path for connection address
API Any Built-in See dataset documentation
EXCEL Any Built-in See dataset documentation
SQL Server mssql pip install pymssql
SQL Server Pool mssqlpool
Oracle oracle pip install cx_Oracle
Oracle Pool oraclepool
PostgreSQL gp pip install psycopg2
Kingbase gp pip install psycopg2
GreenPlum gp pip install psycopg2-binary
Impala impala pip install impyla
Hive hive pip install impyla
DB2 db2 pip install ibm_db
DM (Dameng) dm pip install dmPython
Python python pip install pandas, openpyxl See Datasets -> Special Sources
Redis redis pip install redis See Datasets -> Special Sources
MongoDB mongodb pip install pymongo See Datasets -> Special Sources
ClickHouse clickhouse pip install clickhouse_driver
Elasticsearch es pip install elasticsearch==7.13.0 See Datasets -> Special Sources
Prometheus prometheus See Datasets -> Special Sources
InfluxDB influxdb pip install influxdb
SQLAlchemy sqlalchemy pip install sqlalchemy See Datasets -> Special Sources
JDBC jdbc pip install JayDeBeApi See Datasets -> Special Sources
Feishu EXCEL feishuExcel Pro edition guidance
DingTalk EXCEL dingdingExcel Pro edition guidance
DingTalk Bot dingdingMsg Pro edition guidance
WeCom Message qiweiMsg Pro edition guidance
Vector Database Pro edition guidance
LLM openAI pip install openai See First AI Scene
Bailian Agent bailianAI pip install dashscope See Datasets -> Special Sources
Bailian Model dashAI pip install dashscope
Custom Custom User-defined See Datasets -> Special Sources

Common Issues: If connection fails, check: 1) Host/port is correct; 2) Driver is installed (pip install); 3) Database user has remote access permissions.