Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Add query priority option INTERACTIVE or BATCH #260

Merged
merged 4 commits into from
Jul 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 38 additions & 2 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ There are multiple ways to install bigquery-grafana. See [INSTALL](https://doiti

* Query setup
* Raw SQL editor
* Query formatting
* Query builder
* Macros support
* Additional functions
* Table view
Expand Down Expand Up @@ -98,7 +98,7 @@ Go to [BigQuery API](https://console.cloud.google.com/apis/library/bigquery.goog

![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/newserviceaccount.png)

4. Some new fields will appear. Fill in a name for the service account in the `Service account name` field and then choose the `Monitoring Viewer` role from the `Role` dropdown:
4. Some new fields will appear. Fill in a name for the service account in the `Service account name` field and then choose the `BigQuery Data Viewer` and `BigQuery Job User` roles from the `Role` dropdown:

![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/bq_service_account_choose_role.png)
5. Click the `Create` button. A JSON key file will be created and downloaded to your computer. Store this file in a secure place as it allows access to your BigQuery data.
Expand All @@ -120,6 +120,42 @@ If Grafana is running on a Google Compute Engine (GCE) virtual machine, it is po

Read more about creating and enabling service accounts for GCE VM instances [here](https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances).

### Using the Query Builder
The query builder provides a simple yet a user-friendly interface to help you quickly compose a query. The builder enables you to define the basic parts of your query, The common ones are:
1. The table you want to query from
2. The time field and metric field
3. WHERE clause - Either use one of the pre-defined macros, to speed your writing time, or set up your own expression. Existing supported Macros are:

a. Macro $__timeFiler with last 7 days example:
```
WHERE `createDate` BETWEEN TIMESTAMP_MILLIS (1592147699012) AND TIMESTAMP_MILLIS (1592752499012) AND _PARTITIONTIME >= '2020-06-14 18:14:59' AND _PARTITIONTIME < '2020-06-21 18:14:59'
```
b. Macro $__timeFrom with last 7 days example:
```
WHERE `createDate` > TIMESTAMP_MILLIS (1592223758609) AND _PARTITIONTIME >= '2020-06-15 15:22:38' AND _PARTITIONTIME < '2020-06-22 15:22:38'
```
c. Macro $__timeTo with last 7 days example:
```
WHERE `createDate` < TIMESTAMP_MILLIS (1592828659681) AND _PARTITIONTIME >= '2020-06-15 15:24:19' AND _PARTITIONTIME < '2020-06-22 15:24:19'
```

4. GROUP BY option - You can use a pre-defined macro or use one of the fields from your query
a. time ($__interval,none)
5. ORDER BY option

Note: If your processing location is not the Default US one set your location from the processing Location drop-down at the top right bottom of the query builder

### Troubleshooting
Viewing your Query
1. Use The Query Inspector located at the top of the query builder
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryInspector.png)
2. The query Inspector enables you to see the clean query and troubleshoot SQL errors
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/InspectPanel.png)
The Query builder comes with a set of defaults which are control from the top of the Query Builder
![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryBuilder.png)

![](https://raw.githubusercontent.com/doitintl/bigquery-grafana/master/img/QueryOptions.png)

### Build

The build works with Yarn:
Expand Down
Binary file modified dist/doitintl-bigquery-datasource_darwin_amd64
Binary file not shown.
Binary file modified dist/doitintl-bigquery-datasource_linux_amd64
Binary file not shown.
Binary file modified dist/doitintl-bigquery-datasource_windows_amd64.exe
Binary file not shown.
Loading