Get started with Atlassian Analytics
Learn how to add Atlassian Analytics to a site and understand what you need to query data and create charts.
After creating a custom column or custom table, you can then use it in your visual mode queries.
You can’t reference custom tables and columns in SQL mode queries.
To use a custom column:
Open the chart editor by either selecting Create > Chart from the global navigation or selecting Add chart from a dashboard.
Make sure your query is using Visual mode. You can’t use custom columns in SQL mode.
Select the data source containing the custom column.
Add your custom column. Custom columns appear in the schema browser just as any other column would, and you can add them as a column or filter in your visual mode query as you normally would.
Build the rest of your visual mode query.
Select Run query.
If you switch to SQL mode, you can see what the generated query looks like. The custom SQL you’ve written to create the custom column is inserted directly into the query.
To use a custom table:
Open the chart editor by either selecting Create > Chart from the global navigation or selecting Add chart from a dashboard.
Make sure your query is using Visual mode. You can’t use custom tables in SQL mode.
Select the data source containing the custom table.
Add your column from your custom table. Custom tables appear in the schema browser just as any other table would. You can add columns from your custom table as a column or filter in your visual mode query as you normally would.
Build the rest of your visual mode query.
Select Run query.
When you use a column from your custom table in visual mode queries, Atlassian Analytics injects the custom SQL you’ve written to create the custom table into the FROM clause of the query.
When a custom column or table is edited and re-saved, queries are automatically updated for all of the charts using that custom column or table.
Setting foreign keys on columns in a custom table works the same way as setting foreign keys on regular tables in your data source.
When updating a table without making changes to the query (for example, SELECT * FROM table), you must make at least one change to the query for the query to be evaluated. For example, you can add a temporary comment or dummy column.
There may be times when you need to change a column’s data type, but you can’t change it in your original data source. You can use custom columns to change the column’s data type in Atlassian Analytics (but it won’t make the change to your original data source).
To change a column’s data type, create a custom column in the table containing the column that you want to change. For ease of use, we recommend giving your new custom column the same name as the original column.
In the custom column’s SQL, you’ll need to use the syntax specific to your data source to convert the column’s data type.
Atlassian Analytics does not support some data types such as JSON objects, and XML objects. If this is the case, the SQL type of the column in your Atlassian Analytics schema will show as Unsupported type. While you could create custom tables or custom columns to flatten those objects or cast their values as strings, we recommend handling this in your original data source, not in Atlassian Analytics, so you have more flexibility and better long-term management.
Here are some common examples of how to change string data types to dates:
Google BigQuery syntax
CAST("table_name"."column_name" AS DATE)
MySQL syntax
STR_TO_DATE(table_name.column_name, '%m-%d-%Y')
PostgreSQL syntax
DATE(table_name.column_name)
Was this helpful?