What Database Engines Does DB-GPT Support and How to Configure Database Connections
DB-GPT supports relational and analytical engines including MySQL, PostgreSQL, SQLite, DuckDB, ClickHouse, Vertica, Doris, StarRocks, Spark, and MSSQL, configured via the [service.web.database] section in TOML configuration files.
The eosphoros-ai/DB-GPT repository provides a flexible data source layer that enables natural language-to-SQL translation across multiple database backends. Understanding what database engines DB-GPT supports and how to configure database connections is essential for deploying the webserver with your existing data infrastructure. Each engine connects through SQLAlchemy-compatible connectors located in the dbgpt_ext package, with settings defined in the service configuration files.
Supported Database Engines in DB-GPT
DB-GPT enumerates supported engines in docs/docs/modules/connections.md, categorizing them into production relational databases and high-performance analytical stores. The framework currently supports ten major engines while explicitly marking several popular databases as future work.
Relational and Analytical Engine Support
The following engines are fully implemented and maintained in the current release:
- MySQL – The most popular open-source RDBMS, requiring manual schema initialization after version 0.4.7
- PostgreSQL – Advanced open-source RDBMS available via the optional
datasource_postgresextra - SQLite – Embedded file-based database that requires no additional packages and auto-initializes
- DuckDB – In-process analytical SQL engine ideal for local analytical workloads
- ClickHouse – High-performance column-store for real-time analytics
- Vertica – Cloud-native analytical data warehouse
- Doris – High-performance analytical database for OLAP workloads
- StarRocks – Next-generation analytic data warehouse
- Spark – Distributed analytics engine for big data processing
- MSSQL – Microsoft SQL Server for enterprise environments
Engines marked as TODO or unsupported include Oracle, Redis, MongoDB, HBase, DB2, Couchbase, Elasticsearch, OceanBase, and TiDB.
How to Configure Database Connections in DB-GPT
DB-GPT reads connection parameters from the TOML configuration file specified at startup (typically located in configs/dbgpt-local-*.toml). The framework selects the appropriate connector based on the type field within the [service.web.database] section.
SQLite Default Configuration
SQLite requires no extra dependencies and serves as the default backend for local development. The database file auto-generates on first startup without manual schema creation.
[service.web.database]
type = "sqlite"
path = "pilot/meta_data/dbgpt.db"
As documented in docs/docs/installation/sourcecode.md, this configuration creates the metadata storage automatically, eliminating the need for migration scripts.
MySQL Configuration
For production deployments, MySQL requires explicit connection parameters and manual schema initialization. After configuring the TOML file, you must execute the SQL script located at assets/schema/dbgpt.sql to create the required metadata tables.
[service.web.database]
type = "mysql"
host = "127.0.0.1"
port = 3306
user = "root"
password = "your_password"
database = "dbgpt"
Run the schema initialization command:
mysql -h127.0.0.1 -uroot -p<your_password> < ./assets/schema/dbgpt.sql
This manual step became mandatory after DB-GPT version 0.4.7, as noted in the installation documentation at docs/docs/installation/sourcecode.md.
PostgreSQL Setup
PostgreSQL support resides in an optional extra defined in packages/dbgpt-ext/pyproject.toml. Install the package with the datasource_postgres extra before configuration.
pip install "dbgpt[extras,datasource_postgres]"
Configure the connection in your TOML file:
[service.web.database]
type = "postgres"
host = "localhost"
port = 5432
user = "dbgpt"
password = "your_password"
database = "dbgpt"
Refer to docs/docs/installation/integrations/postgres_install.md for detailed prerequisites and troubleshooting steps specific to the PostgreSQL integration.
DuckDB and Analytical Engines
Analytical engines like DuckDB, ClickHouse, and Vertica follow the same configuration pattern but may omit network parameters in favor of file paths. DuckDB connections require only the database file location.
[service.web.database]
type = "duckdb"
path = "data/duckdb.db"
Each connector implementation in packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/ (such as conn_sqlite.py and conn_mysql.py) exposes the specific parameters required by the underlying driver. Standard fields include host, port, user, password, and database, though file-based engines use path exclusively.
Connector Architecture and Source Files
The datasource layer implements SQLAlchemy-compatible connectors within the dbgpt_ext package. Each engine-specific connector (e.g., SQLiteConnector, MySQLConnector) resides in packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/, providing standardized interfaces for query execution and metadata extraction.
Key source locations include:
- Supported engines list:
docs/docs/modules/connections.md - Installation guides:
docs/docs/installation/sourcecode.md(SQLite/MySQL) anddocs/docs/installation/integrations/postgres_install.md(PostgreSQL) - Schema definitions:
assets/schema/dbgpt.sql(MySQL metadata tables) - Extra dependencies:
packages/dbgpt-ext/pyproject.toml(definesdatasource_postgresand other extras) - Connector implementations:
packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/conn_sqlite.pyand corresponding engine files
Summary
- DB-GPT supports 10 database engines including MySQL, PostgreSQL, SQLite, DuckDB, ClickHouse, Vertica, Doris, StarRocks, Spark, and MSSQL
- Configure connections via the [service.web.database] section in TOML configuration files
- SQLite requires no setup and auto-initializes, while MySQL requires manual schema execution from
assets/schema/dbgpt.sql - PostgreSQL support requires installing the
datasource_postgresextra frompackages/dbgpt-ext - Connectors are implemented in
dbgpt_ext.datasource.rdbmsand selected automatically based on thetypefield
Frequently Asked Questions
Does DB-GPT support Oracle or MongoDB?
No. According to the connections documentation in docs/docs/modules/connections.md, Oracle is marked as TODO and MongoDB is listed as unsupported. The framework currently focuses on relational and analytical SQL engines rather than NoSQL document stores or key-value databases.
Where are the database connector implementations located?
The connector implementations reside in packages/dbgpt-ext/src/dbgpt_ext/datasource/rdbms/. For example, the SQLite connector is defined in conn_sqlite.py, while MySQL logic exists in conn_mysql.py. These files contain the SQLAlchemy-compatible engine definitions that DB-GPT uses to communicate with each database.
Do I need to manually create tables for MySQL?
Yes. Starting with DB-GPT 0.4.7, you must manually initialize the metadata schema when using MySQL. Execute the SQL script located at assets/schema/dbgpt.sql against your target database using the MySQL CLI client before starting the webserver. SQLite does not require this step as it auto-generates tables on first startup.
How do I install PostgreSQL support for DB-GPT?
Install the datasource_postgres extra when setting up your Python environment. Run pip install "dbgpt[extras,datasource_postgres]" to include the necessary PostgreSQL driver dependencies. This extra is defined in packages/dbgpt-ext/pyproject.toml and enables the Postgres connector type in your TOML configuration.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →