feat: add some sample queries to fleet-debugger#137
Open
greghutch wants to merge 1 commit intogooglemaps:mainfrom
Open
feat: add some sample queries to fleet-debugger#137greghutch wants to merge 1 commit intogooglemaps:mainfrom
greghutch wants to merge 1 commit intogooglemaps:mainfrom
Conversation
This attemps to get sample bigquery queries into a more easily consumed form than our documentation. For now, the set of queries is sources from my somewhat unstructured explorations. Once we have a published dataset, we can add per-query documentation and reproducible queries for the user. fix: googlemaps#136
bshi
approved these changes
Jun 30, 2022
| DATE(timestamp) AS date, | ||
| COUNT(DISTINCT labels.task_id) AS active_tasks | ||
| FROM | ||
| \`${argv.dataset}.fleetengine_googleapis_com_update_task\` |
There was a problem hiding this comment.
dataset can be specified on the bq command line so it might be cleaner to read to omit it in the raw SQL.
| const sql = ` | ||
| SELECT | ||
| * | ||
| FROM ( |
There was a problem hiding this comment.
Complex queries like this might be useful to document as a view for easy querying (and visualization in datastudio/looker/etc).
| @@ -0,0 +1,20 @@ | |||
| const { exec } = require("child_process"); | |||
| exports.query = function query(query) { | |||
| const cmd = `bq query --nouse_legacy_sql '${query}'`; | |||
There was a problem hiding this comment.
The SQL in this patch would be more readable if dataset were injected here as a command line parameter of bq
| @@ -0,0 +1,28 @@ | |||
| #!/usr/bin/env node | |||
There was a problem hiding this comment.
Worth writing examples as .sql files with named parameters? Then wrapping not-a-test.sh could just call bq directly. Would remove one layer (nodejs) of indirection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This attemps to get sample bigquery queries into a more easily
consumed form than our documentation. For now, the set of
queries is sources from my somewhat unstructured explorations.
Once we have a published dataset, we can add per-query documentation and
reproducible queries for the user.
Fixes #136