Benchdog SQL Data Comparer
A VS Code extension for comparing the rows of two SQL Server or Azure SQL databases. It shows which rows are the same, which differ and which are on one side only, and writes a sync script or syncs the target. All the work is done by the Benchdog engine (benchdog serve); this extension is the screen.
Install
Install it from the Marketplace in VS Code. The Benchdog engine ships inside the package for Windows (x64), so there is nothing else to install and no .NET needed. Mac and Linux are coming. The desktop app and the benchdog command for the same tool are at benchdog.dev.
What it does
- Comparisons view: a SQL Data Comparer panel in the activity bar lists your saved comparisons, each a source to copy rows from and a target to change. Click one to compare.
- New Comparison: the + button. Pick the source (Azure SQL from your Benchdog account, or a SQL Server by name), then the target, which can be another database on the same server. Each one is tested first.
- Comparison tab: only the tables that differ, or could not be compared, are listed, with how many are the same in the summary. Each shows its rows the same, different, only in the source and only in the target, and a coloured tag, as in the desktop app: amber when it differs, red when it could not be compared. Click a table to see how its rows match, the columns left out and why, notes such as masked columns, and its rows as a grid. Tables left out are listed with why. Compare Again reads both databases again.
- Row grid: each column's source and target values side by side, with the ones that differ marked, and how many rows differ in each column. Tabs show every difference, or only the rows that are different, only in the source, only in the target, or the same. Pages hold 100 rows; Previous and Next read more. Only columns that differ hides the rest.
- Choosing rows: above each grid, Sync turns adding rows only in the source, updating rows that differ, or deleting rows only in the target on or off for that table. Clear a row's tick to leave it as it is. The tick in the table list's header ticks or clears every table that can be synced, and the tick in the grid's Sync header every row on the page; each shows a partial tick when only some are ticked. Your table ticks stay when the tab compares again. The sync script and Sync Target follow your choices, and say how many rows they left as they are.
- Key and Filter: Key... picks the columns that identify a table's rows, for a table with no primary key (Choose Key... beside it). Filter... compares only rows that meet a SQL condition, on both sides. Both are kept with the comparison.
- Show Sync Script: opens the script for what is ticked in a new, unsaved SQL editor, to read, copy or save. It only reads. A very long script opens its first 1,000,000 characters; Save Sync Script writes all of it.
- Save Sync Script: writes a T-SQL script for the ticked tables, to review and run in SSMS, sqlcmd or Azure Data Studio. It runs in one transaction, so a failure changes nothing.
- Sync Target: syncs the ticked tables now, in one transaction, after you confirm. The tab compares again afterwards.
- Let triggers fire: by default the target's triggers are turned off while their tables change, and turned back on after.
- Project files: a
.datacompare.json file keeps a comparison (source, target, tables, keys and filters) to run again from VS Code, the benchdog data compare --project CLI or the desktop app. Right-click a comparison and choose Save as Project File... to write one. Open one to get IntelliSense, its problems in the Problems panel, and a Compare link at the top; Compare, also on the editor title and the Explorer's right-click menu, adds it to the Comparisons view and compares it. A project file never holds a password.
- Sign in and SQL logins work as in Benchdog SQL Documenter: your Benchdog account for Azure SQL, your Windows account for SQL Server on your network, or a SQL login whose password Benchdog keeps until VS Code closes or, if you choose, in the system's secure store. The eye on the password box shows what you typed. Right-click a comparison and choose Forget Passwords to clear them.
Settings
| Setting |
Does |
benchdogDataCompare.enginePath |
Full path to the benchdog executable. Empty uses the one that ships with the extension. |
benchdogDataCompare.tenant |
Tenant id to search for Azure SQL databases. Empty means your home tenant. |
benchdogDataCompare.useAzureCli |
Sign in to Azure SQL through your existing az login instead of the browser. |
The settings are separate from the other Benchdog extensions', so they can all be installed together.
How it stays safe
- Every database is reached as you. The extension keeps only each comparison's servers, database names, how to sign in, key columns and filters; never a password.
- Comparing and writing a script only read. The target changes only after Sync Target and a confirmation that says what changes, and then in one transaction.
- Row values are shown only in the comparison tab, set as text so a value can never become markup. They are never written to a log. The tab is thrown away when hidden, so no value is kept.
Diagnostics
Turn on the benchdogDataCompare.diagnostics setting to have the engine write a debug log of what it does, for finding out why something went wrong. Run Benchdog SQL Data Comparer: Open Diagnostics Logs Folder to see the logs. Passwords, connection strings, tokens and your data are never written.
Trial and licence
Every Benchdog tool has a thirty day trial with every feature and no card: ask for one at benchdog.dev/trial. One licence is for one person and covers the VS Code extension, the desktop app and the command line, on every machine you work from. Prices are at benchdog.dev/pricing. The licence is checked offline; the tool contacts benchdog.dev only when you ask it to, never in the background. The terms are in LICENSE.md and at benchdog.dev/terms.
Help and support
Getting started, how to do the common jobs, the questions people ask and what to try when something goes wrong: benchdog.dev/help/datacompare. Something else? The support form, or support@benchdog.dev, and a person replies.
| |