Building queries

Query datasources from your Equals workbook

πŸ“˜

Workspaces will migrate to a new and improved query experience, starting the week of May 15, 2024. For more, see this help doc.

With Equals, you can connect to and query datasources directly from your workbook to bring live data into your spreadsheet for further analysis.

Before you get started, ensure that you have at least one datasource configured for your workspace.

Connecting to a datasource

To start querying your datasource from a workbook, you'll first need to connect your workbook to that datasource:

  1. Create a workbook and click to open the Connections panel from the top right corner
  2. Click Connect Datasource and choose the datasource you'd like to query
  3. Choose from either the query builder or the SQL editor. The query builder allows you to create a no-code query; the SQL editor allows you to write a custom SQL query.

Using the query builder

If you don't know SQL and want to access your data, you can do so with the query builder.

To get started with the query builder:

  1. Search for tables or columns in your data schema using the first drop down. Then, check the boxes to bring specific columns into your query.
  2. To reorder your columns, drag and drop the column names.
  3. Filter your data by first selecting the column you want to filter, and then setting a rule.
  4. To apply a sort, select the column you want to sort by, then choose ascending or descending order.
  5. Apply a limit to determine the number of rows to bring into your workbook.
  6. Apply a join to join your selection with data from another datasource.
  7. To convert your query into a saved query that can be reused across workbooks, select the Create a saved query option from the ... menu

Once you have customized the selection to your liking, select Run Query to see your data populate in the sheet.

Using the SQL editor

Use the full-featured SQL editor to write a traditional SQL query. The SQL editor includes several features that make it easy to configure your selection, accessible from the top right corner.

To get started with the SQL editor:

  1. Use the table browser to search for specific tables or columns in your data schema by name. You can also hover over the πŸ‘οΈ icon to preview data before bringing a column into your selection.
  2. Select the ✨ icon to use AI Assist for help with writing, modifying, or debugging your query.
  3. Use cell references to include a variable in your SQL query that can be easily modified by typing into the referenced cell in your workbook.
  4. Use query version history to restore past versions of your query and the associated data.
  5. At any time, you can select the Maximize option to expand to a full-width editing experience.
  6. Select the Create a saved query option from the ... menu to convert your query into a saved query that can be reused across workbooks.

Once you have written your query, press Run Query to see your data populate the sheet.

Switching between query interfaces

You can choose to switch between the SQL editor and query builder for a given datasource connection. The option to switch between interfaces is accessible from the ... menu in the top right corner of the SQL editor and query builder. Note that this will affect all users working with that datasource connection in your workbook.

Switching from the query builder to the SQL editor will convert your no-code query into SQL syntax.

Switching from the SQL editor to the query builder will cause you to lose your SQL query, as we can not translate a handwritten SQL query into the builder interface.

FAQ

Can I connect to multiple datasources within a single workbook?

Yes, you can connect as many datasources as you'd like within a single workbook, but only one datasource can be connected per sheet. To connect an additional datasource, simply open a new sheet, go to the Connections panel and choose your datasource.

Who has access to my query?

Generally, workspace users with access to the datasource your query is built on will also have access to view and edit that query. You can share individual access to a query by creating a saved query and that sharing Run or Edit access to individual users (more on saved queries here).

What do I do if my query is not running?

If your query is crashing or not running as expected, reach out to us at [email protected] or message us directly using the messenger widget in the bottom right corner of your screen.