Run Python and R scripts in Azure Data Studio notebooks with SQL Server Machine Learning Services.
Select the kernel, enter the example code in a cell, and click Run cell. The following examples demonstrate using different kernels to run a simple "Hello World" command. If you open a notebook from some other source, it opens in Non-Trusted mode and then you can make it Trusted. The notebooks open in Azure Data Studio are defaulted to Trusted.
If you click in the text cell again, it changes to edit mode. Selecting outside the text cell shows the Markdown text. The cell starts in edit mode in which you can type Markdown text. Text cells allow you to document your code by adding Markdown text blocks in between code cells.Īdd a new text cell by clicking the +Cell command in the toolbar and selecting Text cell. Use code snippets to quickly create copies of your database for development or testing purposes and to generate and execute scripts.
Code snippets allow you to generate the proper SQL syntax to create databases, tables, views, stored procedures, and to update existing database objects. The code cell supports a modern SQL coding experience with built-in features such as a rich SQL editor, IntelliSense, and built-in code snippets. For example, if you're using the SQL kernel, you can enter T-SQL commands in the code cell.Įntering code with the SQL kernel is similar to a SQL query editor. A new code cell is added after the currently selected cell.Įnter code in the cell for the selected kernel.
If you're a PostgreSQL developer and want to connect the notebooks to your PostgreSQL Server, then download the PostgreSQL extension in the Azure Data Studio extension Marketplace and connect to the PostgreSQL server. SQL Kernel can also be used to connect to PostgreSQL server instances. If you're using Python3 Kernel you attach to localhost and you can use this kernel for your local Python development. For example, if you're using SQL Kernel, then you can attach to any of your SQL Server instances. For example, when connected to the SQL Server kernel, you can enter and run T-SQL statements in a notebook code cell.Īttach to provides the context for the kernel. Each kernel supports a different language in the code cells of your notebook.
Open the command palette ( Ctrl+Shift+P), type "new notebook", and select the New Notebook command.Īzure Data Studio notebooks support a number of different kernels, including SQL Server, Python, PySpark, and others. Right-click a SQL Server connection and select New Notebook. Go to the File Menu in Azure Data Studio and select New Notebook. In each case, a new file named Notebook-1.ipynb opens. There are multiple ways to create a new notebook.