sql-server-table-reconciliation
Fungsinya
Tool ini membandingkan tabel yang sama di dua database SQL Server untuk menemukan perbedaannya. Tool ini memeriksa baris yang hilang, perbedaan data pada kolom, atau perubahan pada struktur tabel.
Kapan dipakai
- ✓Memvalidasi data setelah proses migrasi.
- ✓Membandingkan lingkungan produksi dengan lingkungan staging.
- ✓Memastikan proses pembaruan data otomatis (ETL) berjalan sesuai harapan.
Link skill
https://github.com/github/awesome-copilot/blob/main/skills/sql-server-table-reconciliation/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
“Bandingkan tabel 'Customers' dan 'Orders' antara server produksi dan staging.”
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Anda memberikan detail koneksi untuk kedua database SQL Server beserta nama tabelnya. Tool ini mengambil data secara efisien lalu membandingkannya baris demi baris berdasarkan pengenal unik.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
SQL Server Table Reconciliation
Compare identical tables across two SQL Server instances using Python with mssql-python driver and Apache Arrow. Detect missing rows, column mismatches, schema drift, and produce a reconciliation report.
Workflow
- Collect connection details for source and target
- Identify primary key / composite key
- Detect schema differences
- Extract data via Arrow for efficient columnar transfer
- Compare rows and columns
- Generate reconciliation report
Collect Inputs
| Parameter | Required | Description |
|---|---|---|
| Source server | Yes | Source SQL Server (e.g. prod-server.database.windows.net) |
| Source database | Yes | Source database name |
| Target server | Yes | Target SQL Server (e.g. staging-server.database.windows.net) |
| Target database | Yes | Target database name |
| Tables | Yes | Comma-separated schema.table names, or schema.* wildcard (e.g. dbo.Orders,dbo.Items or dbo.*) |
| Auth mode | Yes | sql (user/password) or entra (Azure AD/token) |
| Primary key | Auto-detect | Column(s) forming the row identity. Auto-detect from metadata if not provided. |
| Columns to compare | All | Subset of columns, or all non-PK columns |
| Chunk size | 100000 |
Rows per batch for large tables |
| Output format | console |
console, csv, parquet, or json |
Bundled Script
The reconciliation logic is provided as a standalone script at scripts/reconcile.py. Invoke it with the appropriate arguments based on user inputs:
python scripts/reconcile.py \
--source-server <source_server> \
--source-database <source_database> \
--target-server <target_server> \
--target-database <target_database> \
--tables "<table_spec>" \
--auth <sql|entra> \
--chunk-size <chunk_size> \
--output <console|csv|json>
Optional arguments
| Argument | Description |
|---|---|
--primary-key |
Comma-separated PK column(s). Omit to auto-detect. |
--columns |
Comma-separated columns to compare. Omit to compare all non-PK columns. |
Example invocations
Single table with SQL auth:
python scripts/reconcile.py \
--source-server prod-server.database.windows.net \
--source-database ProdDB \
--target-server staging-server.database.windows.net \
--target-database StagingDB \
--tables "dbo.Orders" \
--auth sql \
--output console
Wildcard with Entra auth and CSV output:
python scripts/reconcile.py \
--source-server prod-server.database.windows.net \
--source-database ProdDB \
--target-server staging-server.database.windows.net \
--target-database StagingDB \
--tables "dbo.*" \
--auth entra \
--output csv
Prerequisites
Install required packages before running:
pip install mssql-python pyarrow pandas
Comparison Rules
- Normalize types before comparing: cast decimals to same precision, trim strings, normalize datetime to UTC
- NULL handling:
NULL == NULLis considered a match (both sides missing = no diff) - Ignore row order: always compare by PK join, never positional
- Large tables: chunk extraction with
OFFSET/FETCHorROW_NUMBER()partitioning
Hash-Based Optimization (for large tables)
When table has >1M rows, generate a hash pre-check:
SELECT {pk_cols},
HASHBYTES('SHA2_256', CONCAT_WS('|', col1, col2, ...)) AS row_hash
FROM {table}
Compare hashes first; only fetch full rows for mismatched hashes. This reduces data transfer significantly.
Report Format
Reconciling dbo.EMPLOYEES...
Reconciling dbo.DEPARTMENTS...
Reconciling dbo.JOBS...
--- dbo.EMPLOYEES ---
Source: 107 Target: 107
Missing: 0 Extra: 0 Mismatches: 0
Result: ✓ IDENTICAL
--- dbo.DEPARTMENTS ---
Source: 27 Target: 27
Missing: 0 Extra: 0 Mismatches: 3
Result: ✗ DIFFERENCES FOUND
--- dbo.JOBS ---
Source: 19 Target: 19
Missing: 0 Extra: 0 Mismatches: 0
Result: ✓ IDENTICAL
=== Summary: 2 passed, 1 failed, 0 skipped / 3 tables ===
When a single table is provided, include full detail (schema drift, sample rows, mismatches). When multiple tables, use the compact per-table format above with full detail only for tables with FAIL status.
Performance Considerations
| Scenario | Strategy |
|---|---|
| < 100K rows | Single Arrow fetch, in-memory pandas compare |
…
Pertanyaan umum
Apa itu primary key?
Primary key adalah kolom (atau sekumpulan kolom) yang mengidentifikasi setiap baris dalam tabel secara unik, seperti nomor KTP untuk penduduk atau ID pesanan untuk penjualan.
Bagaimana tool ini menangani tabel yang sangat besar?
Tool ini bisa memproses tabel dalam potongan-potongan (batch) atau membuat kode ringkasan (hash) untuk setiap baris, lalu membandingkan kode tersebut terlebih dahulu. Cara ini jauh lebih cepat.
Apa yang terjadi jika datanya berbeda?
Tool ini membuat laporan yang menunjukkan baris atau kolom mana yang berbeda, atau baris mana yang hanya ada di salah satu server.
Detail
Deskripsi asli dari pembuat
Use when: comparing SQL Server tables across instances, data migration validation, ETL verification, row mismatch detection, schema drift, reconciliation report, production vs staging comparison. Uses mssql-python driver with Apache Arrow for fast columnar data transfer and comparison.
repo: github/awesome-copilot
Popularitas
- Bintang GitHub
- 40k
- Peringkat
- #7435
- Lisensi
- MIT
- Diperbarui
- 15/10/2026
Komentar
- …
Skill lain dari repositori ini
acquire-codebase-knowledge
40kMembantu agent Anda memahami dan mendokumentasikan proyek kode yang sudah ada. Berguna untuk proses onboarding anggota baru atau mendapatkan gambaran arsitektur.
acreadiness-assess
40kMemungkinkan agent Anda menilai kesiapan proyek untuk AI dan membuat laporannya. Berguna untuk mengetahui seberapa siap proyek menggunakan alat AI.
acreadiness-generate-instructions
40kMembantu agent Anda membuat instruksi untuk alat AI berdasarkan hasil penilaian. Berguna untuk meningkatkan cara AI berinteraksi dengan kode dan menutup celah yang ditemukan.
acreadiness-policy
40kMemungkinkan agent Anda membantu menyusun atau menerapkan kebijakan untuk penilaian proyek AI. Berguna untuk menstandarisasi evaluasi proyek dan memastikan kepatuhan.
Skill serupa
discrawl
394kMemungkinkan agent Anda mencari dan merangkum arsip pesan Discord lokal yang tersimpan, memeriksa seberapa baru arsipnya, dan membaca pesan langsung.
clickhouse-io
280kMembantu agent Anda mengoptimalkan query dan skema di database ClickHouse dengan praktik terbaik analitik berperforma tinggi. Gunakan saat query analitik terlalu lambat.
scientific-db-pubmed-database
280kMembantu agent Anda mencari artikel ilmiah di bidang biomedis. Berguna untuk riset yang membutuhkan informasi medis spesifik.