What This Workflow Does
This n8n workflow solves a common but frustrating problem for businesses using multiple database systems - how to efficiently combine data from Postgres and MySQL sources. Many companies run different applications on different database platforms, creating data silos that make comprehensive reporting and analysis difficult.
The workflow automatically queries specified tables from both database systems, intelligently joins the results based on common fields (like customer IDs or transaction references), and outputs a unified dataset. This eliminates hours of manual data exports, spreadsheet manipulation, and error-prone copy-paste operations.
How It Works
1. Database Connection Setup
The workflow first establishes secure connections to both your Postgres and MySQL databases using configured credentials. These connections use best practices like encrypted credentials and limited-access database users.
2. Parallel Data Querying
It simultaneously executes your configured SQL queries against both databases. The template includes sample queries you can customize to extract exactly the data you need from each system.
3. Data Transformation
The workflow normalizes data formats between the two systems (like date formats or string cases) to ensure clean merging. It can handle type conversions and field mapping between different database schemas.
4. Intelligent Joining
Using your specified join keys (like customer_id or order_number), the workflow combines the datasets while preserving all relevant fields from both sources. It can handle one-to-one, one-to-many, and many-to-many relationships.
5. Result Output
The unified data is formatted into your preferred output structure (JSON, CSV, or direct database insertion) and delivered to your chosen destination - whether that's another application, data warehouse, or notification system.
Who This Is For
This workflow is ideal for:
- Businesses running some applications on MySQL and others on Postgres
- Teams needing combined reports from multiple database systems
- Data analysts tired of manual data merging
- Companies implementing a data warehouse or BI system
- Developers building applications that need unified data access
What You'll Need
- An n8n instance (cloud or self-hosted)
- Read access to your Postgres and MySQL databases
- Basic SQL knowledge to customize the queries
- Understanding of how your data should be joined (common keys)
- Destination for the unified data (webhook, storage, etc.)
Quick Setup Guide
- Download and import the JSON template into your n8n instance
- Configure the Postgres and MySQL node connections with your database credentials
- Modify the SQL queries to match your table structures and data needs
- Set the join keys that will combine your datasets
- Configure the output format and destination
- Test with small datasets first, then schedule or trigger the workflow
Key Benefits
Eliminate manual data merging - No more exporting CSVs from each database and struggling with spreadsheet joins. This workflow automates the entire process with perfect consistency every time.
Real-time data unification - Get combined datasets on demand or scheduled, ensuring your reports and analyses always use the latest information from all systems.
Reduce IT dependency - Business teams can configure and run these joins without waiting for developer resources or custom SQL scripts.
Improve data accuracy - Automated joining eliminates human errors in manual data manipulation, giving you confidence in your unified datasets.
Pro tip: Start with small test datasets to verify your join logic works correctly before processing large volumes of data.