Monitor Order Fulfillment with MySQL and VeloDB Cloud
A paid order can still sit unshipped for hours. Operations teams need a simple way to find these orders before they become customer complaints.
In this tutorial, MySQL continues to process order updates while VeloDB Cloud maintains an analytical copy of the relevant tables. A single query finds paid orders that have not shipped within one hour and adds the merchant information needed to investigate them.
Order updates in MySQL
↓
Full and incremental sync into VeloDB Cloud
↓
Join orders with merchant information
↓
Find paid orders that are more than one hour late
All names, IDs, regions, timestamps, and amounts in this tutorial are synthetic.
Prerequisites
This tutorial uses managed MySQL import, which is in Public Preview and currently documented for VeloDB Cloud 26.1.x warehouses. Check that guide for source configuration and version requirements before creating a job.
You need:
- A reachable MySQL source compatible with MySQL 5.6, 5.7, or 8.0.x.
- A running VeloDB Cloud warehouse with permission to create the target database, tables, and import job. Follow the VeloDB Cloud Quick Start if you need to create one.
- A source setup account that can create and update the demo tables, and an import account with permission to read those tables and replicate their changes.
- Binary logging enabled with row-based logging and full row images. Confirm the requirements in the MySQL import guide.
Use a dedicated demo database on any supported MySQL deployment. For Amazon RDS or Aurora, complete the provider-specific setup linked from the MySQL import guide.
Follow Connect for Import to prepare connectivity for your SaaS or BYOC warehouse. For this walkthrough, use a publicly reachable demo source with restricted network access. A private source needs the network configuration described in that guide.
1. Create the sample order data
Use a new, dedicated order_demo database. The script creates tables if they do not exist, but it does not update an existing schema. Run the following SQL in the source MySQL database. Orders 10001 and 10003 are overdue, while order 10002 has already shipped.
CREATE DATABASE IF NOT EXISTS order_demo;
USE order_demo;
SET time_zone = '+00:00';
CREATE TABLE IF NOT EXISTS merchants (
merchant_id BIGINT PRIMARY KEY,
merchant_name VARCHAR(100) NOT NULL,
region VARCHAR(50) NOT NULL
);
CREATE TABLE IF NOT EXISTS orders (
order_id BIGINT PRIMARY KEY,
merchant_id BIGINT NOT NULL,
customer_id BIGINT NOT NULL,
status VARCHAR(20) NOT NULL,
paid_at DATETIME,
shipped_at DATETIME,
amount DECIMAL(10, 2) NOT NULL,
updated_at DATETIME NOT NULL
);
INSERT INTO merchants VALUES
(101, 'Northstar Home', 'East'),
(102, 'Greenfield Electronics', 'South')
ON DUPLICATE KEY UPDATE
merchant_name = VALUES(merchant_name),
region = VALUES(region);
INSERT INTO orders VALUES
(10001, 101, 90001, 'paid',
DATE_SUB(NOW(), INTERVAL 2 HOUR), NULL, 299.00, NOW()),
(10002, 102, 90002, 'shipped',
DATE_SUB(NOW(), INTERVAL 2 HOUR),
DATE_SUB(NOW(), INTERVAL 80 MINUTE), 499.00, NOW()),
(10003, 101, 90003, 'paid',
DATE_SUB(NOW(), INTERVAL 110 MINUTE), NULL, 99.00, NOW())
ON DUPLICATE KEY UPDATE
merchant_id = VALUES(merchant_id),
customer_id = VALUES(customer_id),
status = VALUES(status),
paid_at = VALUES(paid_at),
shipped_at = VALUES(shipped_at),
amount = VALUES(amount),
updated_at = VALUES(updated_at);
The ON DUPLICATE KEY UPDATE clauses make the sample reusable. Running the script again resets the same fictional rows instead of creating duplicates.
2. Sync MySQL into VeloDB Cloud
-
Log in to the VeloDB Cloud console.
-
In the upper-left corner, select the warehouse that you want to use.
-
In the left navigation pane, click SQL Editor.
-
In the SQL Editor, create the target database:
CREATE DATABASE IF NOT EXISTS order_demo_velodb; -
In the left navigation pane, click Data Integration.
-
If no integration records exist, click Add Import Job. Otherwise, choose Add Data > Import data into VeloDB. Select MySQL, then click Continue. For more information about the wizard, see Import Data.
Configure the source connection:
| Setting | Example value |
|---|---|
| Job Name | mysql_order_demo_to_velodb |
| Host | <your-mysql-host> |
| Port | <your-mysql-port> |
| User | <your-mysql-user> |
| Password | Enter the password in the console. Do not add it to source code. |
| Enable SSL | Enable encrypted connections to the source. |
Then configure the destination and tables:
| Setting | Value used in this tutorial |
|---|---|
| Target Database | Select Existing Database, then order_demo_velodb. |
| Sync Type | Initial Load + Incremental Sync |
| Select Tables to Migrate | order_demo.orders and order_demo.merchants |
| Sync Interval (s) | 60 |
For a SaaS warehouse and this public demo source, leave Reverse Private Endpoint disabled. For a private source, use the network path prepared in Connect for Import. BYOC source connectivity is configured in your cloud network.
The wizard provides Enable SSL for encrypted source connections. If your source requires additional certificate configuration, contact VeloDB Cloud support to confirm the connection options.
Under Settings, select the target Cluster and set Sync Interval (s) to 60. Complete Verify and Confirm, resolve any failed pre-checks, and click Start. Open Import Jobs to monitor the initial load before running the verification queries.
The initial load copies the existing rows. Incremental sync then captures later source changes. When the initial load has finished for all selected tables, run these queries in SQL Editor:
SELECT COUNT(*) AS order_count
FROM order_demo_velodb.orders;
SELECT COUNT(*) AS merchant_count
FROM order_demo_velodb.merchants;
The expected counts are three orders and two merchants.
3. Find overdue orders
Run the following query in SQL Editor. It returns paid orders that have not shipped within one hour, along with the merchant name and region.
The source setup uses UTC timestamps. Set the query session to UTC as well so the one-hour comparison uses the same time basis.
SET time_zone = 'UTC';
SELECT
o.order_id,
m.merchant_name,
m.region,
o.amount,
o.paid_at,
TIMESTAMPDIFF(MINUTE, o.paid_at, NOW()) AS minutes_waiting
FROM order_demo_velodb.orders AS o
JOIN order_demo_velodb.merchants AS m
ON o.merchant_id = m.merchant_id
WHERE o.status = 'paid'
AND o.shipped_at IS NULL
AND o.paid_at < DATE_SUB(NOW(), INTERVAL 1 HOUR)
ORDER BY o.paid_at;
The query combines the latest order status with merchant context and returns only orders that have exceeded the one-hour fulfillment threshold.

Orders 10001 and 10003 both require attention. The exact minutes_waiting values depend on when you run the query.
4. Mark an order as shipped in MySQL
Update order 10001 in the source MySQL database:
USE order_demo;
UPDATE orders
SET status = 'shipped',
shipped_at = NOW(),
updated_at = NOW()
WHERE order_id = 10001;
This update represents the normal business event that occurs when a fulfillment center ships an order.
Optional: run the update with Python
The following example prompts for connection details and uses a CA certificate to verify the MySQL server. Download the CA certificate from your provider before running it:
python3 -m pip install pymysql
import getpass
import ssl
import pymysql
tls_context = ssl.create_default_context(
cafile=input("Path to the MySQL CA certificate: ")
)
connection = pymysql.connect(
host=input("MySQL host: "),
port=int(input("MySQL port: ")),
user=input("MySQL user: "),
password=getpass.getpass("MySQL password: "),
database="order_demo",
ssl=tls_context,
init_command="SET time_zone = '+00:00'",
)
with connection.cursor() as cursor:
cursor.execute("""
UPDATE orders
SET status = 'shipped',
shipped_at = NOW(),
updated_at = NOW()
WHERE order_id = 10001
""")
connection.commit()
connection.close()
If your provider requires mutual TLS, also load the client certificate and private key into the SSL context. Keep credentials and private keys out of source code.
5. Confirm the change in VeloDB Cloud
Wait for a successful synchronization cycle, then run the overdue-order query again. The configured interval is a scheduling setting, so the change can take longer than one interval to become visible.

Verify the source update in VeloDB Cloud:
SELECT order_id, status, shipped_at
FROM order_demo_velodb.orders
WHERE order_id = 10001;
The row should show shipped and a non-null shipped_at. Order 10001 is no longer returned by the overdue-order query because it is now marked as shipped. The row was not deleted from VeloDB Cloud. It simply no longer matches the exception filter. Order 10003 remains because it is still paid, overdue, and unshipped.
The example uses a 60-second sync interval. Actual freshness depends on source activity, job backlog, and available resources. Verify the changed values before relying on an empty exception result.
Why use VeloDB Cloud for this workflow?
MySQL remains the system that processes transactions. VeloDB Cloud receives a continuously updated analytical copy and handles the operational query, including the join between order and merchant data.
This separation lets teams build fulfillment dashboards and exception reports without placing the same analytical workload on the transactional database. You can extend the pattern to cancellations, payment failures, warehouse delays, inventory shortages, and regional fulfillment trends.
Common errors
| Symptom | What to check |
|---|---|
| The connection pre-check fails | Confirm the source host and port, network access rules, TLS certificates, and the selected private endpoint if used. |
| Existing rows do not appear | Confirm that Initial Load + Incremental Sync is selected and that the initial load completed for every selected table. |
| A source update does not appear | Open the import job details and inspect failed tasks. Check replication permissions, source change-log configuration, and job backlog. |
| Counts or query results differ from the example | Check that you selected the demo source tables and the correct target database. Rerun the setup only in the dedicated demo database to restore the starting state. |
For an overdue-order result that differs from the example, also check that the source setup and the SQL Editor session use UTC. A session time-zone difference can change the one-hour comparison.
Cost and cleanup
The source database, running warehouse compute, stored data, and data transfer can incur charges. Review Billing before leaving the demo running.
When you finish:
-
In Data Integration > Import Jobs, find the demo job, choose Delete, and confirm that you are deleting the demo job.
-
If the target database contains only this tutorial's data, remove it in SQL Editor:
DROP DATABASE order_demo_velodb; -
Remove the synthetic source tables or source database only after confirming that they are dedicated to this tutorial.
-
If you created a cluster solely for the demo, pause it when it has no other workloads. Pausing compute does not remove retained storage or cache charges.
Production considerations
- Use a dedicated MySQL account with only the permissions required for synchronization.
- Store credentials in a secret manager instead of scripts or screenshots.
- Use TLS certificate verification and private networking when appropriate.
- Choose a synchronization interval that matches the operational requirement, then validate it under the expected workload.
- Monitor synchronization status and lag before using the data for alerts.
- Replace the synthetic sample with approved and properly governed production data.
To build the same workflow from a PostgreSQL source, see Monitor Order Fulfillment with PostgreSQL and VeloDB Cloud.