You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+58-21Lines changed: 58 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,28 @@ Github Action as a wrapper for executing a single command in stackql, maps all s
6
6
## Provider Authentication
7
7
Authentication to StackQL providers is done via environment variables source from GitHub Actions Secrets. To learn more about authentication, see the setup instructions for your provider or providers at the [StackQL Provider Registry Docs](https://stackql.io/registry).
8
8
9
-
# Examples
10
-
## Query Example
11
-
```
9
+
## Inputs
10
+
-`query` - stackql query to execute **(need to supply either `query` or `query_file_path`)**
11
+
-`query_file_path` - stackql query file to execute **(need to supply either `query` or `query_file_path`)**
12
+
-`data_file_path` - (optional) path to data file to pass to the stackql query preprocessor (`json` or `jsonnet`)
13
+
-`vars` - (optional) comma delimited list of variables to pass to the stackql query preprocessor (supported with `jsonnet` config blocks or `jsonnet` data files only), accepts `var1=val1,var2=val2`, can be used to source environment variables into stackql queries
14
+
-`query_output` - (optional) output format of the stackql exec result, accepts `table`, `csv`, `json`, defaults to `json`
15
+
-`auth_obj_path` - (optional) the path of json file that stores stackql AUTH string **(only required when using non-standard environment variable names)**
16
+
-`auth_str` - (optional) stackql AUTH string **(only required when using non-standard environment variable names)**
17
+
18
+
19
+
## Outputs
20
+
This action uses [setup-stackql](https://github.com/marketplace/actions/stackql-studio-setup-stackql), with use_wrapper set
21
+
to `true`, `stdout` and `stderr` are set to `exec-result` and `exec-error`
22
+
23
+
-`exec-result` - The STDOUT stream of the call to the `stackql` binary.
24
+
-`exec-error` - The STDERR stream of the call to the `stackql` binary.
25
+
26
+
## Examples
27
+
28
+
### Inline `stackql` query example
29
+
30
+
```yaml
12
31
- name: exec github example
13
32
uses: ./
14
33
with:
@@ -22,9 +41,9 @@ Authentication to StackQL providers is done via environment variables source fro
### Query file example using an inline `jsonnet` variable block and external variables
25
45
26
-
## Query File example
27
-
-`google-example.iql`
46
+
`google-example.iql`
28
47
```
29
48
<<<jsonnet
30
49
local project = std.extVar("GOOGLE_PROJECT");
@@ -39,8 +58,9 @@ FROM google.compute.instances
39
58
WHERE project = '{{ .project }}' and zone = '{{ .zone }}'
40
59
GROUP BY status;
41
60
```
42
-
**Example**
43
-
```
61
+
62
+
workflow excerpt:
63
+
```yaml
44
64
- name: exec google example with query file using vars
45
65
id: stackql-exec-file-with-vars
46
66
uses: ./
@@ -53,23 +73,40 @@ GROUP BY status;
53
73
GOOGLE_ZONE: ${{ vars.GOOGLE_ZONE }}
54
74
```
55
75
56
-
## Inputs
57
-
-`query` - stackql query to execute **(need to supply either `query` or `query_file_path`)**
58
-
-`query_file_path` - stackql query file to execute **(need to supply either `query` or `query_file_path`)**
59
-
-`data_file_path` - (optional) path to data file to pass to the stackql query preprocessor (`json` or `jsonnet`)
60
-
-`vars` - (optional) comma delimited list of variables to pass to the stackql query preprocessor (supported with `jsonnet` config blocks or `jsonnet` data files only), accepts `var1=val1,var2=val2`, can be used to source environment variables into stackql queries
61
-
-`query_output` - (optional) output format of the stackql exec result, accepts `table`, `csv`, `json`, defaults to `json`
62
-
-`auth_obj_path` - (optional) the path of json file that stores stackql AUTH string **(only required when using non-standard environment variable names)**
63
-
-`auth_str` - (optional) stackql AUTH string **(only required when using non-standard environment variable names)**
64
-
76
+
### Query file example using an external `jsonnet` data file and external variables
65
77
66
-
## Outputs
67
-
This action uses [setup-stackql](https://github.com/marketplace/actions/stackql-studio-setup-stackql), with use_wrapper set
68
-
to `true`, `stdout` and `stderr` are set to `exec-result` and `exec-error`
78
+
`google-example.iql`
79
+
```sql
80
+
SELECT status, count(*) as num_instances
81
+
FROMgoogle.compute.instances
82
+
WHERE project ='{{ .project }}'and zone ='{{ .zone }}'
83
+
GROUP BY status;
84
+
```
69
85
70
-
-`exec-result` - The STDOUT stream of the call to the `stackql` binary.
71
-
-`exec-error` - The STDERR stream of the call to the `stackql` binary.
86
+
`google-example.jsonnet`
87
+
```
88
+
local project = std.extVar("GOOGLE_PROJECT");
89
+
local zone = std.extVar("GOOGLE_ZONE");
90
+
{
91
+
project: project,
92
+
zone: zone,
93
+
}
94
+
```
72
95
96
+
workflow excerpt:
97
+
```yaml
98
+
- name: exec google example with query file and data file using vars
0 commit comments