microsoft / azuredatastudio

Azure Data Studio is a data management and development tool with connectivity to popular cloud and on-premises databases. Azure Data Studio supports Windows, macOS, and Linux, with immediate capability to connect to Azure SQL and SQL Server. Browse the extension library for more database support options including MySQL, PostgreSQL, and MongoDB.
https://learn.microsoft.com/sql/azure-data-studio
MIT License
7.53k stars 896 forks source link

[Feature] Provide SQL Diff for database objects #843

Closed Ryukote closed 5 years ago

Ryukote commented 6 years ago

It would be awesome if there is SQL Diff in Ops Studio. For example and option to import 2 sql files in Diff to see differences between them or to see difference between 2 queries on the same or different databases.

kburtram commented 6 years ago

@Ryukote this this a suggestion to allow diff'ing the SQL text in two files, or the output data from executing the queries? If it is for textual diff of two SQL files this should be built in from the VS Code platform. First Select for Compare on 1 file then Compare with on 2nd file.

screen shot 2018-03-07 at 9 11 58 pm screen shot 2018-03-07 at 9 12 12 pm
Ryukote commented 6 years ago

Thank you. I didn't know it is already integrated. But for example when I want to compare stored procedure on one database with the same stored procedure on another database I can't do that. It would be bad user experience if I have to save those first, open those files in SQL Ops and then compare them. This should be more like something from the view when I have pop up where I can specify those 2 stored procedures and then see the difference between them.

kburtram commented 6 years ago

@Ryukote we don't currently allow direct diff of database objects. The feature you're mentioning is somewhat similar to what we do in SSDT with Schema Compare. We've talked about implementing that in SQL Ops Studio in the future, but it isn't currently committed.

There may be a simpler, more targeted way to accomplish this where we could script the two objects into local temp files and then diff those. I'll add this suggestion to our backlog to consider for a future release.

Ryukote commented 6 years ago

Sounds great. Thanks.

joshbooker commented 6 years ago

here is a related idea. Please vote.
SSDT-style Import from database and sqlpackage.exe integration (extract, compare, update, publish, etc.) https://github.com/Microsoft/sqlopsstudio/issues/389

and here is a related test project which scripts, extracts, compares and updates using cmd line: https://github.com/joshbooker/sqlOS-Scripter-Extract-Compare-Update

The scripting from database works on any platform while extract, compare, update works only on Windows with SSDT installed. Basically mssql-scripter is already cross-platform.

All we need is cross-platform equivalents of sqlpackage.exe and sqlcmd.exe. Then maybe some context menu options to fire these off in sqlOS. An interactive diff GUI would be nice, but the above functionality first in the short term would be super swell!

thanks for listening.

joshbooker commented 5 years ago

@kburtram is there any update on whether SSDT-style Import from database and sqlpackage.exe integration (extract, compare, update, publish, etc.)

389

ccan move up the backlog? It appears at this point there are indeed cross-plat versions of all dependencies sqlpagacage.exe, sqlcmd.exe, sql-scripter, etc.

We just need a way to wire up these console commands to context menus.

Thanks for listening.

kburtram commented 5 years ago

We currently have the Schema Compare extension available in the Extension Marketplace, which is our recommended solution for this scenario. Please open new issues for any bugs or suggestions encountered while using that extension. Thanks!

@joshbooker we are continually looking at how best to integrate sqlpackage.exe and some of the other SSDT functionality into ADS. Currently we have the DacFx extension to managed .dacpacs and Schema Compare. The support here will continue to improve over time.