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.54k stars 898 forks source link

FR: Follow foreign keys when viewing sql results #248

Open gregveres opened 6 years ago

gregveres commented 6 years ago

Steps to Reproduce: When I do a query, say select top 1000, on a table that has foreign keys, it would be very nice to be able to easily expand that foreign key to see the record it is pointing to. Take a look at LinqPad for an example of where this was done well.

When I read the Sql Ops announcement and how this tool was for Dev Ops, I assumed that something like this would be included. Without a feature like this, navigating the database and modifying the database is so much more complex than it has to be and so much more error prone than it has to be.

I really like LinqPad but SMSS and SQL ops are easier to create that first query to view a table. But then LinqPad blows them away in viewing the results.

And being a Mac guy, I very much appreciate this being available on MacOS.

gregveres commented 5 years ago

I was just filling a couple of other requests / bugs against Azure Data Studio and I decided to fill this one again. But before I did, I decided to look to see if anybody else had submitted it first. I see I did. :)

Have you guys agreed that something like this is useful? Will it make it into the product at some point?

BTW, here is my justification for it as I wrote it up this morning:

Allow an easy way to follow foreign keys.

I will admit that I might not be the typical user, but one thing that would reduce my effort tremendously is the ability to follow foreign key relationships.

Have you seen LinqPad? It does this very, very well. It adds columns at the end of the table for each foreign key in the table. Then, as a user, I can click on the link within that column to have the system query the foriegn record and show it to me in place. (They use a table within a table approach).

My main use case for Azure Data Studio is as a developer to check the data was stored correctly in the database as I develop the application. Following foreign key relationships is crucial for that type of diagnosis.

I also have to maintain the production database and diagnose why a feature isn't working the way that it should. Again, following foreign key relationships is crucial to quickly figure out the problem.

Right now Azure Data Studio takes too much effort to follow these relationships because I have to find the foreign table in the list of tables. I have to create a new query, I have to edit that query to say Id = foriegn key value and then submit that query and switch back and forth between windows to see the results.

When I have to do this for 10 or 20 rows of the original table, it gets very, very tedious.