SQL Analytics
This will help you connect to your ION analytics
Getting started with Analytics is simple this guide will walk you through the following steps and you'll be on your way!

Generating SQL Credentials

ION now supports self-serve database credentials that can be generated within the platform by anyone with an admin role!
Below are the instructions on how an admin can generate analyticsCredentials :

1. Navigate to the GraphiQL Explorer within ION (On the bottom left of screen)

2. Determine the userId and organizationId for the User that needs the credentials via the GraphiQL interface. (you will need the User email).

BODY (Input; Top left section, right under "GraphiQL")
query QueryUser($filters: UserInputFilters!) {
users(filters: $filters) {
edges {
node {
id
organizationId
name
email
_etag
}
}
}
}
Query Variables (Input; Bottom left section, you may need to drag up to enlarge section)
{
"filters": {
"email": {
}
}
}
Results (Output; Right section of screen)
id = userId
{
"data": {
"users": {
"edges": [
{
"node": {
"id": 284,
"organizationId": 1,
"name": "Your Name",
"email": "[email protected]"
}
}
]
}
}
}

3. Create credentials using the userId and organizationId determined above.

BODY
mutation CreateAnalyticsCredential($input: CreateAnalyticsCredentialInput!) {
createAnalyticsCredential(input: $input) {
analyticsCredential {
id
roleName
providerType
password
endpoint
}
}
}
Query Variables
{
"input": {
"userId": "userId",
"organizationId": "organizationId"
}
}
Results
Ensure to securely save your password as you will not be able to recover it again
{
"data": {
"createAnalyticsCredential": {
"analyticsCredential": {
"id": 3,
"roleName": "your__username",
"providerType": "postgres",
"password": "xxxxxxxxxxxxx"
"endpoint": "ionproduction-read-replica.xxxxxxxx.rds.amazonaws.com",
}
}
}
}
The following fields will be needed to set-up your connection in the following step:
roleName = Username; providerType = Database name; password = Password; endpoint = Host

Deleting SQL Credentials

If you do forget your password, than you will need to delete and recreate your analyticsCredentials to connect to the self-serve database.
Below are the instructions on how an admin can delete analyticsCredentials:

1. Determine "etag" of the credentials you want to delete

You will need your "userId" and your credentials "etag" in order to delete your credentials. You can find your userID from the query user script above, and use that to find the "etag" of the credentials.
Body
query analyticsCredentials($filters: AnalyticsCredentialInputFilters!) {
analyticsCredentials(filters: $filters) {
edges {
node{
id
userId
roleName
password
_etag
}
}
}
}
Query Variables
{
"filters": {
"userId": {
"eq": "userID"
}
}
}
Results
_etag = etag
{
"data": {
"analyticsCredentials": {
"edges": [
{
"node": {
"id": 1,
"userId": 284,
"roleName": "your__username",
"endpoint": "ionproduction-read-replica.xxxxxxxx.rds.amazonaws.com"
"providerType": "postgres",
"_etag": "90fd73312898463795f8e0a94eef5e8a"
}
}
]
}
}
}

2. Delete Analytics Credentials

Using the etag and the userID, you can now delete the existing analytics credentials.
mutation DeleteAnalyticsCredentials {
deleteAnalyticsCredential(etag: "your etag", id:"userId") {
id
}
}
Once you have successfully deleted your credentials, you can follow the Generating SQL Credentials guide again to recreate them!

Setting up your Data Connection

You will need a SQL client that support JDBC drivers. Our favorite is DataGrip because it supports a wide range of databases out of the box. But any client that succeeds with this setup guide will work!
Basic Connection Properties (mostly from credential creation above) Host (endpoint) = ionproduction-read-replica.xxxxxxxx.rds.amazonaws.com
Port = 5432
Database name (providerType) = postgres
Username (roleName) = xxxxxx
Password = xxxxxx

Writing your First Query

Your organization will have a unique schema based off of your domain, replace "." with "_" (firstresonnance.io = firstresonance_io), so make sure to replace with the correct info when writing your own queries.
For example the runs table, will be firstresonance_io.runs for the First Resonance organization.

Example Queries:

Count of runs grouped by status:
SELECT status,
count(id)
FROM firstresonance_io.runs
GROUP BY status
Copy link
On this page
Generating SQL Credentials
Deleting SQL Credentials
Setting up your Data Connection
Writing your First Query