DOCS
DOCS

Writing Queries in Baselight Studio

Baselight features a built-in SQL engine that allows users to write and execute SQL queries directly in their browser—no setup, no servers, and no need to export data elsewhere. It’s designed to make working with structured datasets fast, intuitive, and powerful, whether you’re running quick filters or building complex multi-source analyses.

What can you do?

With Baselight’s integrated SQL engine, you can:

  • Query structured datasets directly in your browser.
  • Join data from multiple sources into a single query.
  • Analyze trends, test hypotheses, or extract real-time insights.

Baselight makes it easy to create your own queries without needing any infrastructure setup.


Getting started

Choose Your Dataset

  • Use the Data Catalog to search for a dataset you want to explore. Learn more about the Data Catalog here.
  • Click into a dataset to view its description, source, number of tables, and list of tables.
  • Click into a table to view its schema and sample rows.
  • Select the table you’d like to query by clicking the “Add to Query” button—it will automatically be referenced in your SQL window with the appropriate @namespace.dataset.table format.

Creating new queries

To start writing your new query you’ll first have to open a new query. There are two easy ways to do this:

Once you click on this you’ll be prompted to add a title to your new query and a query description. You can leave the description blank but you are required to add a title. You can also decide if you want the query you are creating to be public and viewed by anyone with the link.

New queries are private by default, so you will need to click the box to make the query public if you want to share it. You can always change this later.

2. When adding a dataset to a query

When you are looking at a dataset you can click the button at the top right next to the dataset title that says “Add to query”. This button will prompt you to do one of two things. You can either add it to an existing query or click “Add to New Query”.

If you click “Add to New Query” the same pop-up shown above will appear asking for a title, description, and if you want to make the query public.

If you decide you want to add it to an existing query of yours you simply click which one and it will be automatically added to that query’s engine.

Once you have added your datasets to a new (or existing) query you are ready to get started with the built in SQL engine.

Write Your SQL query

Baselight supports standard SQL, making it easy for anyone with basic SQL knowledge to jump in. You can run simple queries like:

SELECT * FROM @portals.transactions.swaps

You can use more complex commands to build out detailed queries. Learn more about.

Query data from selected tables

When you have selected the tables you want to use you can easily select, combine, and query data from different tables using the FROM command. 

Once you write your query make sure to end it with FROM to pull the data from the proper dataset. After typing FROM you can then go to the right side of the query engine where your selected datasets will be listed. Click on the three dots of the table you want to query and click “Add to editor”. This will make sure the query you created is pulling from the proper table.


AI query assistant

If you’re having trouble with your queries, Baselight’s AI assistant is here to help. The assistant will analyze the errors and commands in your query, identify what may be causing the issue(s), and suggest ways to fix the query.


Run and view results

Click “Run” in the top right corner of the SQL engine. 

Your results will appear below the query editor in a dynamic table view. Now that you have successfully created and run your queries you can easily [generate visualizations] with Baselight’s built in tools.


Tips

  • You can query multiple datasets by joining them, as long as the keys and time dimensions match.
  • Use aliases (AS) and CTEs (WITH) to keep your queries clean and readable.
  • Toggle between data and visualizations to quickly see patterns in your query results.