Database module
Connect MySQL or PostgreSQL, schema training, presets, and live lookups.
The Database module lets your chatbot answer questions using live data from a connected MySQL or PostgreSQL database—for example product catalogs, inventory, or order status. Configure it per chatbot under Automation > Database.
Where to configure database
Open Automation in the sidebar, then the Database tab. The panel uses internal tabs:
| Tab | Purpose |
|---|---|
| Connect | Database connection credentials and test |
| Schema | Tables, columns, access modes, and relationships |
| Training | Purpose, instructions, row limits, identity verification |
| Test | Ask sample questions and inspect generated SQL |
| Logs | Query history and guard outcomes |
Connection
Enter host, port, database name, username, and password for your MySQL or PostgreSQL instance. Test the connection before saving. Use SSL mode appropriate for your hosting environment.
Disconnecting removes the stored connection for that chatbot.
Schema sync and tables
After connecting, import schema to discover tables and columns. For each table you can:
- Enable or disable it for AI queries.
- Set access mode: PUBLIC (any visitor) or PERSONAL (scoped to a verified customer).
- For personal tables, specify an identity scope column (for example
billing_emailon orders). - Add AI descriptions so the model understands each table and column.
- Review relationships between tables (introspected, manual, or from presets).
Re-sync when your database schema changes.
WooCommerce preset
If the connected database is a WooCommerce store, Chatloop can detect the WordPress table prefix and offer a WooCommerce preset. Applying the preset configures curated tables (products, categories, orders, and related joins) with sensible access modes—public catalog data versus personal order data scoped to the customer's email.
Always review preset configuration before going live with customer-facing traffic.
Training
On the Training tab, describe:
- Purpose — What the database is for (for example "Acme store catalog and order lookup").
- Instructions — Rules for when to query, how to join tables, and what to refuse.
- Max rows per query — Safety limit on result size.
- Identity verification — How personal data is scoped (for example email OTP or order ID plus email).
Testing and logs
Use Test to ask natural-language questions and see whether the assistant generates safe SQL and useful answers. Logs show recent queries, success/failure, guard codes, and whether identity scoping was applied.
Security notes
- Only enable tables and columns the assistant truly needs.
- Use PERSONAL access mode for order history, account data, and other sensitive rows.
- Personal queries are guarded—results are scoped to the verified customer's identity.
- Rotate database credentials if they may have been exposed.
Permissions
Configuring the Database module requires settings-level access (owner or admin) on the chatbot. The Database tab appears only when the module is entitled on your subscription.