packages/integrations-docs/src/integrations_docs/docs/database.md
The Database Integration connects Reflex Build apps to an existing SQL database. When you enable the connection for an app, Reflex Build can inspect its schema and use that structure while generating the app.
The integration is saved at the project level. Open an app's Integrations panel to enable it for that app when needed.
Use Connection Details to enter each part of the connection separately.
For PostgreSQL, MySQL, and MSSQL, choose the database type and enter:
hostname: the database server address.port: defaults to 5432 for PostgreSQL, 3306 for MySQL, or 1433 for MSSQL.username and password: the database credentials.database_name: the database to connect to.For MSSQL, Trust Server Certificate skips certificate identity validation. Use it only as a temporary workaround for an untrusted or self-signed server certificate, and prefer configuring a certificate that the client trusts.
For SQLite, select SQLite and enter an HTTP or HTTPS SQLite Download URL. Reflex Build downloads the database file before using it.
Use Database URI when you have a complete connection URI for one of the supported database types. For example:
postgresql://username:password@hostname:5432/database_name
Enter the URI in db_url, then select Save Changes. Reflex Build selects the database driver automatically. Include provider-required connection options as query parameters when needed.
Use an SSH tunnel when the database is on a private network but can be reached through a bastion host. This option is available for PostgreSQL, MySQL, and MSSQL in both connection modes. It is not available for SQLite.
ssh_hostname, ssh_port (usually 22), and ssh_username for the bastion host.The SSH account must allow port forwarding to the database host and port. Use a dedicated, restricted SSH key and database user for Reflex Build.
# Keep credentials private
Enter database passwords, connection URIs, and SSH private keys only in the integration form. Do not put them in prompts, knowledge, source code, or screenshots.
Open the app's Integrations panel and enable the saved database connection. Reflex Build then connects to the database and, when the app does not already have a model file, creates the app's data models from the schema.
If the connection fails, check that:
# NoSQL Databases
Use the dedicated MongoDB integration when applicable. For another NoSQL database, add its Python SDK or configure a custom integration; the Database Integration supports SQL databases.