Ponderings, insights and industry updates

Using Hydrolix with VSCode

Published: May 5, 2021

Updated: July 5, 2022

Author: David Sztykman | PM - Integrations and Ecosystem

Tags: ,

On top of being a great code editor, Visual Studio Code (VSCode) has a great ecosystem with various plugins allowing users to automate many different tasks.

Hydrolix being a fully restful API, allows you to manage, configure ingest data.

Here we’ll see how we can use VSCode with Hydrolix to configure tables, transformation, and ingest jobs. After configuring our Hydrolix infrastructure from VSCode, we’ll also view data using SQL query using another plugin from VSCode.

Installing the plugin

For this example we’ll use 2 different very popular plugins for VSCode:

  • REST Client allows us to send HTTP requests and view the response in Visual Studio Code directly.
  • ClickHouse driver for SQLTools allows us to do SQL query via the clickhouse connector.

There are several ways to install those plugins. The easiest way is to look into VSCode extensions:

After searching for each extension and installing those we can start working with Hydrolix.

Making your first API call

In this example I’ve setup several variables:

  • @base_url: URL to use with Hydrolix API schema
  • @username: email address you used when you created your cluster
  • @password: password defined when you first login into your Hydrolix portal

The @variable creates a local variable within the file.

The ### and the # @name login allows us to delimit and name each API call within our file.

We’ll use this naming convention across the file.

Here we make a POST request into/login with the header:
“Content-Type: application/json”

And the POST body is a json object with the username and password.

At the bottom of the file we specify two variables which are getting populated automatically from the response:

  • @acces_token: is the JWT contains in our response body
  • @org_id: is the organization ID required for the next API call

Those two variables are critical as they are required for every other call to our REST API.

Some API Examples

Creating a new project:

Create  a new table:

View table information:

Hydrolix provides a full documentation of the different rest API available here:

We have a GitLab repository where we’ll host example usage of VSCode with our different API.

You can download a full example here which contains every steps from project creation, table creation, and transform to specify the format of the data and finally ingesting rows.

To play with this example save file as .http open it with VSCode, then you can either run each individual request via the Send Request button or run the whole file via  ctrl + alt + R

Using SQL Client in VSCode

As Hydrolix is using Clickhouse SQL engine, you can configure your VSCode with the Clickhouse plugin to connect to Hydrolix and execute SQL queries.

To configure your SQL connection click on the database icon in VSCode and add a new connection:

Click on the Clickhouse Driver installed:

Then fill the next form with the information for your cluster:

You can now do SQL query directly from VSCode:

With a single Code Editor you can manage everything – from project creation to ingesting data and viewing it!

Share Now