SQL Server to TiDB SQL Replay Tool for Openclaw

An automated workflow to collect SQL Server slow queries and replay them on TiDB to validate compatibility and analyze performance differences.

dongdong-bryant
v1.0.0
Apr 12, 2026
0
444
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install sqlserver-tidb-replay

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install sqlserver-tidb-replay using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is SQL Server to TiDB SQL Replay Tool?

The SQL Server to TiDB SQL Replay tool is a technical utility designed for database administrators and developers planning a migration. It allows for the capture of production-level slow query logs from SQL Server via Extended Events and replays them in a controlled TiDB environment. This process is essential for identifying syntax incompatibilities, such as T-SQL specific clauses, and assessing the performance gain or loss before moving live traffic.

By utilizing Openclaw Skills, teams can automate the complex task of normalizing non-standard SQL Server logs into clean, executable SQL. The skill provides an end-to-end pipeline that moves from raw data collection to a professional HTML analysis report, featuring automated syntax conversion suggestions and migration risk assessments.

SQL Server to TiDB SQL Replay Tool Use Cases

  • Pre-migration validation to identify syntax errors between SQL Server and TiDB.
  • Performance benchmarking to compare T-SQL execution times against TiDB distributed processing.
  • Automated generation of SQL rewrite suggestions for incompatible T-SQL features.
  • Stress testing TiDB clusters using real-world production query patterns.

How SQL Server to TiDB SQL Replay Tool Works

  1. Data Collection: Use PowerShell scripts to capture Extended Events (XE) from SQL Server and export them to a CSV format.
  2. Normalization: Run the normalization script to clean the CSV, removing XE prefixes and merging multi-line SQL statements.
  3. Parsing: Convert the standardized CSV into a structured JSON format required for parallel replay execution.
  4. Replay Execution: Use the multi-threaded Python engine to execute queries against TiDB, maintaining session-level ordering via connection IDs.
  5. Analysis: Generate a detailed HTML report summarizing the compatibility rate, performance deltas, and specific syntax conversion requirements.

SQL Server to TiDB SQL Replay Tool Setup

Ensure your environment has Python 3.8+ and the necessary libraries (pandas, pymysql). For collection, PowerShell 5.1+ is required on the Windows host.

First, configure your TiDB connection:

export TIDB_HOST="your-tidb-host"
export TIDB_PORT="4000"
export TIDB_USER="root"
export TIDB_PASSWORD="your-password"
export TIDB_DATABASE="test_db"

Then, execute the normalization and replay scripts as part of your Openclaw Skills workflow to begin the validation process.

SQL Server to TiDB SQL Replay Tool Data Schema & Taxonomy

The skill manages data across several stages of the migration lifecycle:

File Type Description
*_raw.csv Original captured data from SQL Server Extended Events
*_standard.csv Normalized SQL text with cleaned parameters and formatting
*.format.json Intermediate replay format containing SQL, timestamps, and connection IDs
replay_report.html Final assessment report including performance Top 10 and error distribution

SQL Server to TiDB SQL Replay Tool Advanced Features

  • Automated Syntax Mapping: Detects and suggests fixes for T-SQL patterns like OUTPUT clauses, TOP vs LIMIT, and OPENJSON.
  • Connection-Aware Replay: Maintains serial execution order for queries belonging to the same session ID to preserve logical consistency.
  • Parallel Worker Support: Adjustable thread count to simulate varying levels of concurrency and load.
  • Unicode Handling: Automatically transforms N-prefix Unicode strings into CAST operations compatible with TiDB character sets.
  • Detailed Performance Delta: Direct comparison between SQL Server duration and TiDB execution time at the individual query level.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*