Page 59 - MSDN Magazine, December 15, 2017
P. 59
Figure 9 The Widget Code Created
from the Graph View of the Query Results
where it makes the most sense. But imagine the types of metada- ta you can expose visually on the dashboards to, for example, see which queries are running slowly or perform other health checks or view important statistics. You can also use the settings to con- trol how widgets are laid out in the dashboard.
We’ve Just Scratched the Surface
There is so much more to discover and do in SQL Operations Studio. Here are a few extra tidbits before wrapping up.
You may have noticed the Explain button on the query window. It will show you query plans just as you see them in SSMS, with an alternate grid view, as well.
The file you created for the TableSize query can now be tracked and shared with the integrated source control. I’ve already been doing that in this project to save some queries that I spent too much time work- ing out. If your team is using source control already for your databases, you’ll find many more sophisticated uses for this feature.
Take a look back at the dashboard in Figure 1 and notice the search widget. A Server dashboard will show a list of its databases and you can easily search for database objects rather than perusing through the Object Explorer. The Database dashboard will show a list of tables, views, functions and procedures, and you can search for database objects by name there, as well.
You can learn so much more about SQL Operations Studio in the official docs at aka.ms/sqlopsstudio, where you’ll find detailed doc- uments about its features, as well as walk-throughs. Remember that SQL Operations Studio was spawned from VS Code, which already has more than 4,500 extensions, most of which have come from the community. In addition to the enormous amount of work that the SQL Data Tools team is pouring into SQL Operations Studio, this new tool will likely take on a life of its own when its own eco- system of extensions begins to evolve.
Head over to aka.ms/sqlopsstudio to download SQL Operations Studio for Linux, macOS and Windows and check out the Getting Started guides. You can watch videos of SQL Operations Studio at aka.ms/ sqlopsstudio-tutorial. And don’t forget to provide feedback, file issues, make suggestions and submit pull requests to improve SQL Operations Studio atgithub.com/microsoft/sqlopsstudio. n
Julie lerman is a Microsoft Regional Direc- tor, Microsoft MVP, software team mentor and consultant who lives in the hills of Ver- mont. You can find her presenting on data access and other topics at user groups and conferences around the world. She blogs at the datafarm.com/blog and is the author of “Programming Entity Framework,” as well as a Code First and a DbContext edition, all from O’Reilly Media. Follow her on Twitter: @julielerman and see her Pluralsight courses at juliel.me/PS-Videos.
Thanks to the following Microsoft techni- cal experts for reviewing this article:
Eric Kang and Sanjay Nagamangalam
Dec. 15, 2017 / Connect(); Special Issue 55
{
"name": "My-Widget", "gridItemConfig": {
"sizex": 2,
"sizey": 1 },
"widget": { "insights-widget": {
"type": { "horizontalBar": {
"dataDirection": "vertical", "dataType": "number", "legendPosition": "none", "labelFirstColumn": false, "columnsAsLabels": false
} },
"queryFile": "/Users/julialerman/Documents/sqlopsstudio/TableSizes.sql" }
} }
database.widgets. Hover over that text and a pencil icon will appear to the left. Click the pencil icon and select the “Replace in settings” menu option that appears. This will cause the entire section of the default set- ting to be copied over to the user settings panel on the right. VS Code is so cool, isn’t it? Now, paste the JSON you copied above the opening brace for the Tasks widget, as shown here, and follow it with a comma:
"dashboard.database.widgets": [ **paste your new widget here** {
"name": "Tasks",
Save the settings file and close it. Then, back in Object Explorer, right-click on one of the databases and choose Manage to see its dashboard. The new widget appears on the dashboard (see Figure 10) and on the dashboard of every database you open. The query it’s tied to will run on-demand when you open the dashboard for a current view. This widget won’t appear on the Servers dashboard because I specifically placed it in the Database dashboard settings,
Figure 10 The Dashboard for the AdventureWorksLTSample Database with the New Widget in Place
msdnmagazine.com