Skip to main content

Synchronize MySQL database schemas to Pinecone with OpenAI embeddings

Workflow preview

Workflow preview
100%
Synchronize MySQL database schemas to Pinecone with OpenAI embeddings preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

This workflow synchronizes MySQL database table schemas with a vector database in a controlled, idempotent manner. Each database table is indexed as a single vector to preserve complete schema cont...

Best for

  • Document Extraction automation workflows
  • AI RAG automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.mysql, n8n-nodes-base.code, n8n-nodes-base.datatable, n8n-nodes-base.if, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Chandan Singh.

Original n8n.io source

1.1 Workflow description

Title
Synchronize MySQL database schemas to Pinecone with OpenAI embeddings
Workflow name
Synchronize MySQL database schemas to Pinecone with OpenAI embeddings

This workflow synchronizes MySQL database table schemas with a vector database in a controlled, idempotent manner. Each database table is indexed as a single vector to preserve complete schema context for AI-based retrieval and reasoning. The workflow prevents duplicate vectors and automatically handles schema changes by detecting differences and re-indexing only when required.

How it works

  • The workflow starts with a manual trigger and loads global configuration values.
  • All database tables are discovered and processed one by one inside a loop.
  • For each table, a normalized schema representation is generated, and a deterministic hash is calculated.
  • A metadata table is checked to determine whether a vector already exists for the table.
  • If a vector exists, the stored schema hash is compared with the current hash to detect schema changes.
  • When a schema change is detected, the existing vector and metadata are deleted.
  • The updated table schema is embedded as a single vector (without chunking) and upserted into the vector database.
  • Vector identifiers and schema hashes are persisted for future executions.

Setup steps

  • Set the MySQL database name using mysql_database_name.
  • Configure the Pinecone index name using pinecone_index.
  • Set the vector namespace using vector_namespace.
  • Configure the Pinecone index host using vector_index_host.
  • Add your Pinecone API key using pinecone_apikey.
  • Select the embedding model using embedding_model.
  • Configure text processing options:
    • chunk_size
    • chunk_overlap
  • Set the metadata table identifier using dataTable_Id.
  • Save and run the workflow manually to perform the initial schema synchronization.

Limitations

  • This workflow indexes database table schemas only. Table data (rows) are not embedded or indexed.
  • Each table is stored as a single vector. Very large or highly complex schemas may approach model token limits depending on the selected embedding model.
  • Schema changes are detected using a hash-based comparison. Non-structural changes that do not affect the schema representation will not trigger re-indexing.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sync DB Schema to Vector Store

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 3 - Load Global Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Fetch All Database Tables

Type / Role
n8n-nodes-base.mySql - mySql
Config choices
Version 2.4

Block 5 - Set Table Schema Context

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Fetch Table Schema Definition

Type / Role
n8n-nodes-base.mySql - mySql
Config choices
Version 2.4

Block 7 - Generate Schema Hash

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 8 - Check Existing Vector Metadata

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 9 - Vector Exists?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 10 - Schema Changed?

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 11 - Delete Existing Vector (Pinecone)

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.3

Block 12 - Delete Vector Metadata Record

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 13 - Split Schema Text (No Chunking)

Type / Role
@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter - textSplitterRecursiveCharacterTextSplitter
Config choices
Version 1

Block 14 - Generate Schema Embeddings

Type / Role
@n8n/n8n-nodes-langchain.embeddingsOpenAi - embeddingsOpenAi
Config choices
Version 1.2

Block 15 - Upsert Vector Metadata Record

Type / Role
n8n-nodes-base.dataTable - dataTable
Config choices
Version 1

Block 16 - Prepare Schema Document

Type / Role
@n8n/n8n-nodes-langchain.documentDefaultDataLoader - documentDefaultDataLoader
Config choices
Version 1

Block 17 - Insert Schema Vector to Pinecone

Type / Role
@n8n/n8n-nodes-langchain.vectorStorePinecone - vectorStorePinecone
Config choices
Version 1

Block 18 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 19 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 20 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 21 - Loop Over executable queries

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 22 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Synchronize MySQL database schemas to Pinecone with OpenAI embeddings
Complexity advanced
Nodes 22
Categories Document Extraction, AI RAG
Author Chandan Singh
Published 19 Dec 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/11971/11971.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Synchronize MySQL database schemas to Pinecone with OpenAI embeddings do?

This workflow synchronizes MySQL database table schemas with a vector database in a controlled, idempotent manner. Each database table is indexed as a single vector to preserve complete schema cont...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Document Extraction, AI RAG use case.