This article shows how to use Azure Data Studio to connect to Managed Service for TimescaleDB on Azure and then use SQL statements to create a hyper table and query it.
Prerequisites
To complete this quickstart, you need Azure Data Studio, the PostgreSQL extension for Azure Data Studio, and access to a Managed Service for TimescaleDB on the Azure server.
Make a note of the Host, Port, Database Name, User, and Password for Managed Service for TimescaleDB service on Azure.
Connect to Managed Service for TimescaleDB on Azure
Start Azure Data Studio.
The first time you start Azure Data Studio, the Connection dialog opens. If the Connection dialog doesn't open, select the New Connection icon in the SERVERS page:
In the form that pops up, go to Connection type and select PostgreSQL from the drop-down.
Fill in the remaining fields using the host, port, user, database name, and password for your Managed Service for TimescaleDB on Azure.
Setting
Example value
Description
Server name
<REMOTE_HOST>.timescaledb.io
The hostname of your Managed Service for TimescaleDB service.
Authentication type
Password
The authentication type.
User name
tsdbadmin
Your username.
Password (SQL Login)
P@ssw0rd
Your password.
Password
Check
Check this box to avoid entering the password each time you connect.
Database name
defaultdb
The default database for Managed Service for TimescaleDB service is defaultdb. You can also specify the name of the database.
Server group
Default
This option lets you assign this connection to a specific server group you create.
Name (optional)
leave blank
This option lets you specify a friendly name for your server.
Select Advanced.
In the Port field, type the port number, and select OK.
Select Connect.
After successfully connecting, your server opens in the SERVERS sidebar.
Create a hyper table
The following steps create a hyper table in the default defaultdb database:
In the SERVERS sidebar, right-click the server and select New Query.
Paste the following SQL statement into the query editor and select Run.
Note
You can either append this or overwrite the existing query in the editor. Selecting Run executes only the query that is highlighted. If nothing is highlighted, select Run to execute all queries in the editor.
SQL
CREATETABLE conditions ( -- create a regular tabletime TIMESTAMPTZ NOTNULL,
location TEXTNOTNULL,
temperature DOUBLEPRECISIONNULL);
SELECT create_hypertable('conditions', 'time'); -- turn it into a hypertable
Insert rows
Paste the following snippet into the query window and select Run:
Administer an SQL Server database infrastructure for cloud, on-premises and hybrid relational databases using the Microsoft PaaS relational database offerings.