Database Node
Query relational databases directly from your workflows.
Overview
The Database node allows you to connect to MySQL, PostgreSQL, or MongoDB databases and execute queries. It supports both simple visual query building and advanced raw SQL/query mode.
Don't need an external database? If you want to store and query data directly inside Ubex without setting up MySQL, PostgreSQL, or MongoDB, use Tables in My Data instead. Tables work as built-in database tables with full CRUD support via Query Data and Write Data nodes. See the My Data documentation for details.
Supported Databases
| Database | Port | Description |
|---|---|---|
| MySQL | 3306 | Popular open-source relational database |
| PostgreSQL | 5432 | Advanced open-source relational database |
| MongoDB | 27017 | NoSQL document database |
Configuration
Connection Settings
| Field | Description | Required |
|---|---|---|
Database Type |
MySQL, PostgreSQL, or MongoDB | Yes |
Connection |
Select saved connection or create new | Yes |
Output Variable |
Variable name to store query results | Yes |
New Connection
| Field | Description |
|---|---|
Host |
Database server address |
Port |
Database port (auto-filled based on type) |
Username |
Database user |
Password |
Database password |
Database Name |
Name of the database to connect to |
SSL |
Enable SSL/TLS encryption |
SSH Tunnel (Optional)
| Field | Description |
|---|---|
SSH Host |
SSH server address |
SSH Port |
SSH port (default: 22) |
SSH Username |
SSH user |
SSH Password |
SSH password or private key |
Query Modes
Simple Mode
Build queries visually without writing SQL:
- Select Table - Choose from available tables
- Select Columns - Pick columns to return (or all)
- Add Conditions - Filter with WHERE clauses
- Order By - Sort results
- Group By - Aggregate data
- Limit/Offset - Pagination
Advanced Mode
Write raw SQL queries with full control:
SELECT u.name, COUNT(o.id) as order_count
FROM users u
LEFT JOIN orders o ON u.id = o.user_id
WHERE u.created_at > '2024-01-01'
GROUP BY u.id
ORDER BY order_count DESC
LIMIT 10
Condition Operators
| Operator | Description |
|---|---|
= |
Equals |
!= |
Not equals |
> / < |
Greater/Less than |
>= / <= |
Greater/Less or equal |
LIKE |
Pattern matching |
IN |
Value in list |
IS NULL |
Value is null |
IS NOT NULL |
Value is not null |
Using Variables
Use template variables in your queries:
SELECT * FROM users WHERE id = {{user_id}}
Or in conditions (Simple mode):
Column: status
Operator: =
Value: {{filter_status}}
Query Parameters
For advanced mode, use parameterized queries for security:
SELECT * FROM users WHERE email = $1 AND status = $2
Then map parameters:
$1→{{user_email}}$2→{{status}}
Best Practices
- Save and reuse connections across workflows
- Use parameterized queries to prevent SQL injection
- Add appropriate indexes for frequently queried columns
- Use LIMIT to avoid returning too much data
- Test queries with small datasets first