• Products
  • Documentation
  • Resources

What is SQL mode?

If you feel more comfortable creating SQL queries from scratch, you can do so by using SQL mode in your “Query” step. If you added columns or filters in visual mode then switched to SQL mode, you’ll see the same auto-generated SQL query that also appears in the SQL preview in visual mode’s advanced drawer. The key difference here is you can edit that SQL query to include more complex SQL functions that may not be feasible to do via visual mode.

Select a data source

Before you can start building your query, you need to decide from where to query the data. Select the data sources dropdown next to the name of your query, then select one of your connected data sources.

Like in visual mode, you can only query one data source at a time in SQL mode. If you’d like to query multiple data sources in your chart, you’ll need to create a query for each data source then merge those queries together in Visual SQL. Learn more about merging queries.

If you don’t see any data sources, connect one to Atlassian Analytics or reach out to your organization admin for access.

Select SQL mode

After selecting a data source to query, select SQL in your query to use SQL mode.

SQL mode selected for Visual SQL query.

Building queries in visual mode then switching to SQL mode is a great way to generate the basic structure of return values—and even joins—before editing the query with more specific needs.

Write your SQL query

The SQL syntax used for your SQL mode query must be the syntax for your data source’s underlying database type. However, the SQL syntax in all other Visual SQL steps is SQLite.

The Atlassian Data Lake is a Databricks database, so use the appropriate SQL syntax when querying the Data Lake. Learn more about Databricks SQL syntax.

Also keep in mind that Atlassian Analytics blocks certain SQL commands to prevent malicious queries from being sent to your data sources. Learn more about restricted SQL commands.

Use Command + Shift + F to nicely format your SQL query.

Run your query

When you feel like your query is ready, select Run query to execute it. The result table and chart preview will update with your query results.

If you reference any variables in your SQL mode query, you can see the actual values passed for those variables in the executed query. Learn more about executed queries.

You can also use Command + Enter (for Mac) or Control + Enter to run your query.

After running your first query, you can start adding other Visual SQL steps to further transform your data. View all the available Visual SQL steps.


Switching between visual and SQL mode

Making changes and executing the query in visual mode updates the query in SQL mode, but this isn’t true for the reverse—making changes and executing the query in SQL mode doesn’t affect what’s shown in visual mode.

If you’re switching between visual mode and SQL mode, your changes to visual mode don’t impact your returned results until you rerun your query from visual mode.

Rerunning the query in visual mode may override changes you’ve made in SQL mode.

Additional Help