未加星标

An ultimate guide to Azure Data Studio

字体大小 | |
[系统(windows) 所属分类 系统(windows) | 发布者 店小二05 | 时间 2018 | 作者 红领巾 ] 0人收藏点击收藏
An ultimate guide to Azure DataStudio

Azure Data Studio is a class-platform database tool: If you are a MacOS or linux user, you can see this as a mini-version of SQL Server Management Studio (SSMS) and my savior from a virtual machine to run SQL server.

Azure DS is equipped with Intellisense (fancy out-complete), version control integration (Git) as well as a really cool T-SQL editor. It can save your results as text, CSV or JSON.

Let’s go ahead and get started:

Installation Setting up Azure SQL database:

You will need a server to link Azure DS to (in my case, I link it to Azure SQL database). If you are not familiar with how to create your own FREE Azure SQL database, you can follow this step-by-step tutorial that I created earlier.

Download and Install Azure DataStudio:

Download your Azure DS, and install it (Mac users, just double-click on it:D)


An ultimate guide to Azure Data Studio
Azure Data Studio Connection prompt Setup your connection with Azure SQL database:

At launch, Azure DS prompts you to connect to a server. Here are the key inputs that you will need:

Connection Type: Microsoft SQL Server Server: you can fetch this piece of information from your Azure SQL database (if you followed the tutorial mentioned earlier , it should be something like sql-test-medium-001.database.windows.net ) Authentication Type: SQL Login Username: your server log-in that you set-up for your server (tutorial) Password: same password used to set-up your server Database: Select your database name Name (optional): something easy to remember
An ultimate guide to Azure Data Studio
Example of where to find your server name in Azure SQLdatabase Test your connection:

STOP: Before you proceed, if you didn’t set up your server’s firewall to allow connections, your connection prompt will pop this form below. Add your client IP and your Azure account , and you should be good to go.


An ultimate guide to Azure Data Studio
Firewall prompt

You should see your server connected. You can expand the tables in your server by clicking on the drop down in your left pane.


An ultimate guide to Azure Data Studio

To test your connection, click on New Query or hit cmd-N to open a new query window. Type this SQL command to test your connection:

SELECT * FROM SalesLT.Customer; and then hit Run . You should expect an output just like the one below.


An ultimate guide to Azure Data Studio

Did you notice the Intellisense at play? ― This is really my favorite part!

Create stored procedures

If you are familiar with job scheduling in SSMS, this is it’s Azure DS equivalent, just much cooler!

Open a new query window or hit cmd-N Type sql, which should show you a drop-down menu. Select sqlCreateStoredProc It will create a template for a stored procedure. Let’s break it down into different pieces:
An ultimate guide to Azure Data Studio

A. Checks if there exists any other stored procedure with the same name, Drops it and creates this one

B. Creates this stored procedure

C. Executes this stored procedure

4. Let’s update the template to fit our needs:


An ultimate guide to Azure Data Studio
Example for change all occurences Right-click on StoredProcedureName, click on Change All Occurrences and change it to the name you want to call your procedure. I named it testProc Also, Right-click on Schema , click on Change All Occurrences and change it to your schema name (By default, if you didn’t set it up, it should be dbo, so swap it to dbo ) Update the function of the stored procedure:
An ultimate guide to Azure Data Studio
Take @customerID as input Select all the records which have the same CustomerID as the input Hit Run . This will create your stored procedure, and also runs it: EXECUTE dbo.testProc 1 will run testProc with @customerID = 1. How to change your output toJSON

Starting from the stored procedure we just used, we will output the data in a JSON format. Now, this might come in handy in different scenarios, but in my case: it fits perfectly for a visualization tool with a javascript front end.

Reminder: In this stored procedure, we fetch all the data for any customer with the input customer id.


An ultimate guide to Azure Data Studio

Now, let’s aim to store the output in a JSON file. You just add this command after your query: FOR JSON PATH et voilà!

Let’s see how the output looks like below. You can even add this command after any query and the output will be in JSON format.

PS: Even if the command has a squiggly line underneath it ― it still works, trust me, I tried it:)

How to create COOL visualizations

This is huge ― I am super excited that Azure Data Studio lets you create your own mini visualizations instead of just a table. You can even add it to a dashboard that constantly refreshes (can become handy in query performance, PSI calculations or literally anything).

Let’s get started already!

Create aninsight
An ultimate guide to Azure Data Studio

Write a small query just to try this out:

SELECT title as Titles, count(*) as Count

FROM SalesLT.Customer

GROUP by Title

This query will fetch all the different titles for the customers, and then groups them and returns the count of each title.

2. Instead of the tabulated results, you can click on the plot icon on the right.

3. This will show you a bar plot that represents our data. Don’t forget to click Use First Column as row label in the bar plot’s settings. The actual plot is so cool, it shows you a clear legend with a tooltip functionality to check the actual count

本文系统(windows)相关术语:三级网络技术 计算机三级网络技术 网络技术基础 计算机网络技术

tags: your,Azure,SQL,will,procedure
分页:12
转载请注明
本文标题:An ultimate guide to Azure Data Studio
本站链接:https://www.codesec.net/view/604388.html


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 系统(windows) | 评论(0) | 阅读(13)