We present how we can create a new Azure SQL Database using Azure Data Studio, this tool has proven to be a differential in the management of your SQL Server in the Cloud
1. How to create
Creating a new instance of SQL Server on Azure can be performed through the Azure Portal by following the steps below:
2. Creating a new database via script (Python Kernel):
In Azure Data Studio, you can use a Python kernel to run scripts. Below is an example of a Python script to create a new database:
# Using Python in Azure Data Studio # Connect to SQL Server server_name = 'ServerName' database_name = 'NewDatabase' conn_str = f'DRIVER=ODBC Driver 17 for SQL Server; SERVER={server_name}; DATABASE=master; Trusted_Connection=yes;' # Run SQL command to create database create_db_query = f'CREATE DATABASE {database_name};' # Run the command using the pyodbc library import pyodbc with pyodbc.connect(conn_str, autocommit=True) as connection: connection.execute(create_db_query)
3. How to identify database cost with the Azure Pricing Calculator:
4. Reduce cost by enabling the
In Azure SQL Database, you can enable the auto-pause function to reduce costs when the database is not in use. This allows the database to be automatically paused during periods of inactivity and resumed when needed.
These are general guidelines and the exact steps may vary based on specific versions of Azure Data Studio and Azure Portal configurations. Be sure to refer to the official documentation for more detailed information.
Data Scientist and Consultant for Digital and Analytics Solutions
@fabioms