gazer 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 166d9eef0212c5bd6a896a1351e5bfc6953bbd92853fed3903c86e54d4653186
4
- data.tar.gz: '086fcc08489ca7155f76c04dbed03bef703b4e3ec67fe5b10a2daf1df9581781'
3
+ metadata.gz: '08df27aaf125092476d3b5cc5a35c07aec483a6785d45d57a24965e2a5f6e5e8'
4
+ data.tar.gz: 417f85b8b695e2edd7e8758714991650dae3c95a7e0edb513b9dd282d6fcfaa4
5
5
  SHA512:
6
- metadata.gz: c773b741bf66c92a8b9892278f99813c2fb4a2597a565aab43ab1d512ce52abfda28030180277ec61d43db02de5cd36895e394057b8c855b9ebda559729482c2
7
- data.tar.gz: 38d00674ecc4c7c6900e9a59ff0a770039ce9d3703e378532d1ef68f83d1f1ca064d6cbf26d1f3b64cf17fa46c939ddc89a01f6e920886dfea50ab2665f3bb0b
6
+ metadata.gz: 5a708df5171e637f015bd55156a9c19b5dde8d0a8acc536e906aeb7a2ca6ddfca88ed49ed11db8d0457b62c29fbd95510d3029ed76831e5a3250fd9690b644a6
7
+ data.tar.gz: 564f6d56e7d6ac26cf88ca4276752014b0a91005359389fab11b37a71251c8ecaa279e91ee0c30576594107b982cf19dceacc523e624d2cb81bd8556c399ec22
@@ -0,0 +1,21 @@
1
+ name: Label all new/reopened issues with P3
2
+ on:
3
+ issues:
4
+ types:
5
+ - reopened
6
+ - opened
7
+ jobs:
8
+ label_issues_p3:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ issues: write
12
+ steps:
13
+ - uses: actions/github-script@v6
14
+ with:
15
+ script: |
16
+ github.rest.issues.addLabels({
17
+ issue_number: context.issue.number,
18
+ owner: context.repo.owner,
19
+ repo: context.repo.repo,
20
+ labels: ["p3"]
21
+ })
@@ -19,7 +19,8 @@ jobs:
19
19
 
20
20
  test:
21
21
  name: Test - Looker.${{ matrix.looker }} / Ruby.${{ matrix.ruby-version }}
22
- runs-on: ubuntu-latest
22
+ runs-on:
23
+ group: large-ubuntu
23
24
  needs: setup
24
25
  strategy:
25
26
  matrix:
@@ -62,7 +63,7 @@ jobs:
62
63
  bundler-cache: false
63
64
 
64
65
  - name: Install dependencies
65
- run: bundle install
66
+ run: bin/setup
66
67
 
67
68
  - name: Check that Looker is ready
68
69
  run: |
@@ -83,6 +84,148 @@ jobs:
83
84
  --fail
84
85
  if: failure()
85
86
 
87
+ - name: Login persistently
88
+ run: |
89
+ exe/gzr session login
90
+
91
+ - name: Create Connection
92
+ run: |
93
+ cat > Connection_faa_mysql.json <<HERE
94
+ {
95
+ "name": "faa",
96
+ "host": "${{ secrets.FAA_MYSQL_HOSTNAME }}",
97
+ "port": "3306",
98
+ "database": "flightstats",
99
+ "db_timezone": "UTC",
100
+ "query_timezone": "UTC",
101
+ "schema": null,
102
+ "max_connections": 30,
103
+ "ssl": false,
104
+ "verify_ssl": false,
105
+ "tmp_db_name": "tmp",
106
+ "pool_timeout": 120,
107
+ "sql_runner_precache_tables": true,
108
+ "sql_writing_with_info_schema": true,
109
+ "uses_tns": false,
110
+ "pdt_concurrency": 1,
111
+ "dialect_name": "mysql",
112
+ "username": "${{ secrets.FAA_MYSQL_USERNAME }}",
113
+ "password": "${{ secrets.FAA_MYSQL_PASSWORD }}"
114
+ }
115
+ HERE
116
+ exe/gzr connection import Connection_faa_mysql.json --token_file
117
+
118
+ - name: Test Connection
119
+ run: |
120
+ exe/gzr connection test faa --token_file
121
+
122
+ - name: Change the session to dev mode
123
+ run: |
124
+ exe/gzr session get --token_file
125
+ exe/gzr session update dev --token_file
126
+
127
+ - name: Import the project
128
+ run: |
129
+ cat > Project_faa.json <<HERE
130
+ {
131
+ "name": "faa",
132
+ "uses_git": true
133
+ }
134
+ HERE
135
+ exe/gzr project import Project_faa.json --token-file
136
+
137
+ - name: Create a deploy key and set it on the github repo for the project
138
+ run: |
139
+ DEPLOY_KEY=$(exe/gzr project deploy_key faa --token_file)
140
+ echo $DEPLOY_KEY
141
+ SET_KEY_RESPONSE=$(
142
+ curl -L \
143
+ -X POST \
144
+ -H "Accept: application/vnd.github+json" \
145
+ -H "Authorization: Bearer ${{ secrets.LOS_AUTO_BOT_MANAGE_FAA_DEPLOY_KEY }}" \
146
+ -H "X-GitHub-Api-Version: 2022-11-28" \
147
+ https://api.github.com/repos/looker-open-source/faa/keys \
148
+ -d "{\"title\":\"test_key $(uuidgen)\",\"key\":\"$DEPLOY_KEY\",\"read_only\":false}"
149
+ )
150
+ echo $SET_KEY_RESPONSE
151
+ echo "KEY_ID=$(jq .id <<<$SET_KEY_RESPONSE)" >> $GITHUB_ENV
152
+
153
+ - name: Set the project github connection
154
+ run: |
155
+ cat > github_repo.json <<HERE
156
+ {
157
+ "git_remote_url": "git@github.com:looker-open-source/faa.git",
158
+ "git_service_name": "github"
159
+ }
160
+ HERE
161
+ exe/gzr project update faa github_repo.json --token-file
162
+
163
+ - name: Check the project config
164
+ run: |
165
+ exe/gzr project cat faa --trim --token-file
166
+
167
+ - name: Check available branches for faa project
168
+ run: |
169
+ exe/gzr project branch faa --all --token-file
170
+
171
+ - name: Checkout a shared branch
172
+ run: |
173
+ exe/gzr project checkout faa main --token_file
174
+
175
+ - name: Deploy to production
176
+ run: |
177
+ exe/gzr project deploy faa --token_file
178
+
179
+ - name: Configure lookml model
180
+ run: |
181
+ cat > Model_faa.json <<HERE
182
+ {
183
+ "name": "aviation",
184
+ "project_name": "faa",
185
+ "unlimited_db_connections": false,
186
+ "allowed_db_connection_names": [
187
+ "faa"
188
+ ]
189
+ }
190
+ HERE
191
+ exe/gzr model import Model_faa.json --token_file
192
+
193
+ - name: run a query against the model
194
+ run: |
195
+ cat > query.json <<HERE
196
+ {
197
+ "model": "aviation",
198
+ "view": "aircraft_types",
199
+ "fields": ["aircraft_types.description","aircraft_types.count"],
200
+ "pivots": null,
201
+ "fill_fields": null,
202
+ "filters": null,
203
+ "filter_expression": null,
204
+ "sorts": [
205
+ "aircraft_types.description"
206
+ ],
207
+ "limit": "500"
208
+ }
209
+ HERE
210
+ exe/gzr query runquery "$(cat query.json)"
211
+
212
+ - name: Load a dashboard
213
+ run: |
214
+ me=$(exe/gzr user me --csv --plain)
215
+ echo $me
216
+ dest_folder=$(cut -d, -f5 <<< $me | sed 's/"//g')
217
+ exe/gzr dashboard import examples/Dashboard_17_FAA_KPIs.json $dest_folder
218
+
219
+ - name: Remove the deploy key from the github repo
220
+ if: ${{ always() }}
221
+ run: |
222
+ curl -L \
223
+ -X DELETE \
224
+ -H "Accept: application/vnd.github+json" \
225
+ -H "Authorization: Bearer ${{ secrets.LOS_AUTO_BOT_MANAGE_FAA_DEPLOY_KEY }}" \
226
+ -H "X-GitHub-Api-Version: 2022-11-28" \
227
+ https://api.github.com/repos/looker-open-source/faa/keys/$KEY_ID
228
+
86
229
  - name: Run tests
87
230
  run: bundle exec rake
88
231
 
@@ -0,0 +1,20 @@
1
+ name: Label issues that need triage
2
+ on:
3
+ issues:
4
+ types:
5
+ - opened
6
+ jobs:
7
+ label_issues_p3:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ issues: write
11
+ steps:
12
+ - uses: actions/github-script@v6
13
+ with:
14
+ script: |
15
+ github.rest.issues.addLabels({
16
+ issue_number: context.issue.number,
17
+ owner: context.repo.owner,
18
+ repo: context.repo.repo,
19
+ labels: ["need triage"]
20
+ })
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.9](https://github.com/looker-open-source/gzr/compare/v0.3.8...v0.3.9) (2023-05-25)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * model import handles case where model already exists ([302b4db](https://github.com/looker-open-source/gzr/commit/302b4db60ecf0a3b5fc92c34f1fd36f9afaf8f40))
9
+
3
10
  ## [0.3.8](https://github.com/looker-open-source/gzr/compare/v0.3.7...v0.3.8) (2023-05-16)
4
11
 
5
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gazer (0.3.8)
4
+ gazer (0.3.9)
5
5
  faraday (~> 1.10.3)
6
6
  looker-sdk (~> 0.1.1)
7
7
  net-http-persistent (~> 4.0, >= 4.0.1)
@@ -0,0 +1,687 @@
1
+ {
2
+ "description": "",
3
+ "hidden": false,
4
+ "query_timezone": null,
5
+ "refresh_interval": null,
6
+ "title": "FAA KPIs",
7
+ "slug": "DdT8Pnsg6kAB63KqoqgCza",
8
+ "preferred_viewer": null,
9
+ "alert_sync_with_dashboard_filter_enabled": false,
10
+ "background_color": null,
11
+ "crossfilter_enabled": false,
12
+ "dashboard_elements": [
13
+ {
14
+ "body_text": null,
15
+ "dashboard_id": "17",
16
+ "id": "58",
17
+ "look": null,
18
+ "look_id": null,
19
+ "merge_result_id": null,
20
+ "note_display": null,
21
+ "note_state": null,
22
+ "note_text": null,
23
+ "query": {
24
+ "id": "138",
25
+ "view": "airports",
26
+ "fields": [
27
+ "airports.count"
28
+ ],
29
+ "pivots": null,
30
+ "fill_fields": null,
31
+ "filters": null,
32
+ "filter_expression": null,
33
+ "sorts": [
34
+
35
+ ],
36
+ "limit": "500",
37
+ "column_limit": "50",
38
+ "total": null,
39
+ "row_total": null,
40
+ "subtotals": null,
41
+ "vis_config": {
42
+ "custom_color_enabled": true,
43
+ "custom_color": "#239f23",
44
+ "show_single_value_title": true,
45
+ "show_comparison": false,
46
+ "comparison_type": "value",
47
+ "comparison_reverse_colors": false,
48
+ "show_comparison_label": true,
49
+ "show_view_names": true,
50
+ "show_row_numbers": true,
51
+ "truncate_column_names": false,
52
+ "hide_totals": false,
53
+ "hide_row_totals": false,
54
+ "table_theme": "editable",
55
+ "limit_displayed_rows": false,
56
+ "enable_conditional_formatting": false,
57
+ "conditional_formatting_include_totals": false,
58
+ "conditional_formatting_include_nulls": false,
59
+ "type": "single_value",
60
+ "series_types": {
61
+ },
62
+ "hidden_fields": [
63
+
64
+ ],
65
+ "y_axes": [
66
+
67
+ ]
68
+ },
69
+ "filter_config": null,
70
+ "visible_ui_sections": null,
71
+ "client_id": "TCBsruUX7essTBavT7aRXD",
72
+ "model": "aviation",
73
+ "dynamic_fields": null,
74
+ "query_timezone": null
75
+ },
76
+ "query_id": "138",
77
+ "refresh_interval": null,
78
+ "result_maker_id": "54",
79
+ "subtitle_text": null,
80
+ "title": "Total number of airport facilities in US",
81
+ "title_hidden": false,
82
+ "title_text": null,
83
+ "type": "vis",
84
+ "rich_content_json": null,
85
+ "extension_id": null,
86
+ "alerts": [
87
+
88
+ ]
89
+ },
90
+ {
91
+ "body_text": null,
92
+ "dashboard_id": "17",
93
+ "id": "59",
94
+ "look": null,
95
+ "look_id": null,
96
+ "merge_result_id": null,
97
+ "note_display": null,
98
+ "note_state": null,
99
+ "note_text": null,
100
+ "query": {
101
+ "id": "139",
102
+ "view": "airports",
103
+ "fields": [
104
+ "airports.average_elevation"
105
+ ],
106
+ "pivots": null,
107
+ "fill_fields": null,
108
+ "filters": null,
109
+ "filter_expression": null,
110
+ "sorts": [
111
+
112
+ ],
113
+ "limit": "500",
114
+ "column_limit": "50",
115
+ "total": null,
116
+ "row_total": null,
117
+ "subtotals": null,
118
+ "vis_config": {
119
+ "type": "single_value",
120
+ "custom_color_enabled": true,
121
+ "custom_color": "#841984",
122
+ "show_single_value_title": true,
123
+ "show_comparison": false,
124
+ "comparison_type": "value",
125
+ "comparison_reverse_colors": false,
126
+ "show_comparison_label": true,
127
+ "single_value_title": "Average Airport Elevation",
128
+ "hidden_fields": [
129
+
130
+ ],
131
+ "y_axes": [
132
+
133
+ ]
134
+ },
135
+ "filter_config": null,
136
+ "visible_ui_sections": null,
137
+ "client_id": "sX3WEVdUqMeRRt4xYIKWZT",
138
+ "model": "aviation",
139
+ "dynamic_fields": null,
140
+ "query_timezone": "America/Los_Angeles"
141
+ },
142
+ "query_id": "139",
143
+ "refresh_interval": null,
144
+ "result_maker_id": "55",
145
+ "subtitle_text": null,
146
+ "title": "Average Airport Elevation",
147
+ "title_hidden": false,
148
+ "title_text": null,
149
+ "type": "vis",
150
+ "rich_content_json": null,
151
+ "extension_id": null,
152
+ "alerts": [
153
+
154
+ ]
155
+ },
156
+ {
157
+ "body_text": null,
158
+ "dashboard_id": "17",
159
+ "id": "60",
160
+ "look": null,
161
+ "look_id": null,
162
+ "merge_result_id": null,
163
+ "note_display": null,
164
+ "note_state": null,
165
+ "note_text": null,
166
+ "query": {
167
+ "id": "140",
168
+ "view": "airports",
169
+ "fields": [
170
+ "airports.count",
171
+ "airports.state"
172
+ ],
173
+ "pivots": null,
174
+ "fill_fields": null,
175
+ "filters": null,
176
+ "filter_expression": null,
177
+ "sorts": [
178
+ "airports.count desc"
179
+ ],
180
+ "limit": "5",
181
+ "column_limit": "50",
182
+ "total": null,
183
+ "row_total": null,
184
+ "subtotals": null,
185
+ "vis_config": {
186
+ "stacking": "",
187
+ "show_value_labels": true,
188
+ "label_density": 25,
189
+ "legend_position": "center",
190
+ "x_axis_gridlines": false,
191
+ "y_axis_gridlines": true,
192
+ "show_view_names": true,
193
+ "limit_displayed_rows": false,
194
+ "y_axis_combined": true,
195
+ "show_y_axis_labels": true,
196
+ "show_y_axis_ticks": true,
197
+ "y_axis_tick_density": "default",
198
+ "y_axis_tick_density_custom": 5,
199
+ "show_x_axis_label": true,
200
+ "show_x_axis_ticks": true,
201
+ "x_axis_scale": "auto",
202
+ "y_axis_scale_mode": "linear",
203
+ "x_axis_reversed": false,
204
+ "y_axis_reversed": false,
205
+ "ordering": "none",
206
+ "show_null_labels": false,
207
+ "show_totals_labels": false,
208
+ "show_silhouette": false,
209
+ "totals_color": "#808080",
210
+ "type": "looker_column",
211
+ "map": "auto",
212
+ "map_projection": "",
213
+ "quantize_colors": false,
214
+ "series_types": {
215
+ },
216
+ "limit_displayed_rows_values": {
217
+ "show_hide": "show",
218
+ "first_last": "first",
219
+ "num_rows": "10"
220
+ },
221
+ "y_axes": [
222
+ {
223
+ "label": "Number of Airports",
224
+ "orientation": "left",
225
+ "series": [
226
+ {
227
+ "id": "airports.count",
228
+ "name": "Airports Count",
229
+ "axisId": "airports.count"
230
+ }
231
+ ],
232
+ "showLabels": true,
233
+ "showValues": true,
234
+ "unpinAxis": false,
235
+ "tickDensity": "default",
236
+ "tickDensityCustom": 8,
237
+ "type": "linear"
238
+ }
239
+ ],
240
+ "x_axis_label": "State",
241
+ "hidden_fields": [
242
+
243
+ ]
244
+ },
245
+ "filter_config": null,
246
+ "visible_ui_sections": null,
247
+ "client_id": "47uUmVNOmKSNiigru7sYv9",
248
+ "model": "aviation",
249
+ "dynamic_fields": null,
250
+ "query_timezone": "America/Los_Angeles"
251
+ },
252
+ "query_id": "140",
253
+ "refresh_interval": null,
254
+ "result_maker_id": "56",
255
+ "subtitle_text": null,
256
+ "title": "Top states with airports",
257
+ "title_hidden": false,
258
+ "title_text": null,
259
+ "type": "vis",
260
+ "rich_content_json": null,
261
+ "extension_id": null,
262
+ "alerts": [
263
+
264
+ ]
265
+ },
266
+ {
267
+ "body_text": null,
268
+ "dashboard_id": "17",
269
+ "id": "61",
270
+ "look": null,
271
+ "look_id": null,
272
+ "merge_result_id": null,
273
+ "note_display": null,
274
+ "note_state": null,
275
+ "note_text": null,
276
+ "query": {
277
+ "id": "141",
278
+ "view": "airports",
279
+ "fields": [
280
+ "airports.facility_type",
281
+ "airports.average_elevation",
282
+ "airports.count"
283
+ ],
284
+ "pivots": null,
285
+ "fill_fields": null,
286
+ "filters": null,
287
+ "filter_expression": null,
288
+ "sorts": [
289
+ "airports.average_elevation desc"
290
+ ],
291
+ "limit": "5",
292
+ "column_limit": "50",
293
+ "total": null,
294
+ "row_total": null,
295
+ "subtotals": null,
296
+ "vis_config": {
297
+ "stacking": "",
298
+ "show_value_labels": true,
299
+ "label_density": 25,
300
+ "legend_position": "center",
301
+ "x_axis_gridlines": false,
302
+ "y_axis_gridlines": true,
303
+ "show_view_names": true,
304
+ "limit_displayed_rows": false,
305
+ "y_axis_combined": true,
306
+ "show_y_axis_labels": true,
307
+ "show_y_axis_ticks": true,
308
+ "y_axis_tick_density": "default",
309
+ "y_axis_tick_density_custom": 5,
310
+ "show_x_axis_label": true,
311
+ "show_x_axis_ticks": true,
312
+ "x_axis_scale": "auto",
313
+ "y_axis_scale_mode": "linear",
314
+ "x_axis_reversed": false,
315
+ "y_axis_reversed": false,
316
+ "ordering": "none",
317
+ "show_null_labels": false,
318
+ "show_totals_labels": false,
319
+ "show_silhouette": false,
320
+ "totals_color": "#808080",
321
+ "type": "looker_bar",
322
+ "series_types": {
323
+ },
324
+ "limit_displayed_rows_values": {
325
+ "show_hide": "show",
326
+ "first_last": "first",
327
+ "num_rows": "10"
328
+ },
329
+ "y_axes": [
330
+ {
331
+ "label": null,
332
+ "orientation": "top",
333
+ "series": [
334
+ {
335
+ "id": "airports.count",
336
+ "name": "Airports Count",
337
+ "axisId": "airports.count"
338
+ }
339
+ ],
340
+ "showLabels": true,
341
+ "showValues": true,
342
+ "unpinAxis": false,
343
+ "tickDensity": "default",
344
+ "tickDensityCustom": 8,
345
+ "type": "linear"
346
+ },
347
+ {
348
+ "label": "Number of airports",
349
+ "orientation": "bottom",
350
+ "series": [
351
+ {
352
+ "id": "airports.average_elevation",
353
+ "name": "Airports Average Elevation",
354
+ "axisId": "airports.average_elevation"
355
+ }
356
+ ],
357
+ "showLabels": true,
358
+ "showValues": true,
359
+ "valueFormat": "",
360
+ "unpinAxis": false,
361
+ "tickDensity": "default",
362
+ "tickDensityCustom": 8,
363
+ "type": "linear"
364
+ }
365
+ ],
366
+ "x_axis_label": "Facility Type",
367
+ "hidden_fields": [
368
+
369
+ ]
370
+ },
371
+ "filter_config": null,
372
+ "visible_ui_sections": null,
373
+ "client_id": "ePYKdWwylnHenjMx3x2tg3",
374
+ "model": "aviation",
375
+ "dynamic_fields": null,
376
+ "query_timezone": null
377
+ },
378
+ "query_id": "141",
379
+ "refresh_interval": null,
380
+ "result_maker_id": "57",
381
+ "subtitle_text": null,
382
+ "title": "Top 5 airport facilities by average elevation",
383
+ "title_hidden": false,
384
+ "title_text": null,
385
+ "type": "vis",
386
+ "rich_content_json": null,
387
+ "extension_id": null,
388
+ "alerts": [
389
+
390
+ ]
391
+ },
392
+ {
393
+ "body_text": null,
394
+ "dashboard_id": "17",
395
+ "id": "68",
396
+ "look": {
397
+ "id": "6",
398
+ "title": "Average Elevation",
399
+ "user_id": "1",
400
+ "description": "Average Airport Elevation",
401
+ "is_run_on_load": true,
402
+ "query_id": "148",
403
+ "query": {
404
+ "id": "148",
405
+ "view": "airports",
406
+ "fields": [
407
+ "airports.average_elevation"
408
+ ],
409
+ "pivots": null,
410
+ "fill_fields": null,
411
+ "filters": null,
412
+ "filter_expression": null,
413
+ "sorts": [
414
+
415
+ ],
416
+ "limit": "500",
417
+ "column_limit": null,
418
+ "total": null,
419
+ "row_total": null,
420
+ "subtotals": null,
421
+ "vis_config": {
422
+ "custom_color_enabled": true,
423
+ "show_single_value_title": true,
424
+ "show_comparison": false,
425
+ "comparison_type": "value",
426
+ "comparison_reverse_colors": false,
427
+ "show_comparison_label": true,
428
+ "enable_conditional_formatting": false,
429
+ "conditional_formatting_include_totals": false,
430
+ "conditional_formatting_include_nulls": false,
431
+ "custom_color": "#e0e629",
432
+ "type": "single_value",
433
+ "defaults_version": 1,
434
+ "hidden_fields": [
435
+
436
+ ],
437
+ "y_axes": [
438
+
439
+ ]
440
+ },
441
+ "filter_config": {
442
+ },
443
+ "visible_ui_sections": null,
444
+ "client_id": "paGrX9Hy3le4Z3neIAxNsg",
445
+ "model": "aviation",
446
+ "dynamic_fields": null,
447
+ "query_timezone": null
448
+ },
449
+ "folder_id": "5",
450
+ "deleted": false,
451
+ "public": false
452
+ },
453
+ "look_id": "6",
454
+ "merge_result_id": null,
455
+ "note_display": null,
456
+ "note_state": null,
457
+ "note_text": null,
458
+ "query": null,
459
+ "query_id": null,
460
+ "refresh_interval": null,
461
+ "result_maker_id": "64",
462
+ "subtitle_text": null,
463
+ "title": null,
464
+ "title_hidden": false,
465
+ "title_text": null,
466
+ "type": "vis",
467
+ "rich_content_json": null,
468
+ "extension_id": null,
469
+ "alerts": [
470
+
471
+ ]
472
+ },
473
+ {
474
+ "body_text": null,
475
+ "dashboard_id": "17",
476
+ "id": "70",
477
+ "look": {
478
+ "id": "8",
479
+ "title": "Airports",
480
+ "user_id": "1",
481
+ "description": "",
482
+ "is_run_on_load": true,
483
+ "query_id": "150",
484
+ "query": {
485
+ "id": "150",
486
+ "view": "airports",
487
+ "fields": [
488
+ "airports.count"
489
+ ],
490
+ "pivots": null,
491
+ "fill_fields": null,
492
+ "filters": null,
493
+ "filter_expression": null,
494
+ "sorts": [
495
+
496
+ ],
497
+ "limit": "500",
498
+ "column_limit": null,
499
+ "total": null,
500
+ "row_total": null,
501
+ "subtotals": null,
502
+ "vis_config": {
503
+ "color_application": {
504
+ "collection_id": "b43731d5-dc87-4a8e-b807-635bef3948e7",
505
+ "palette_id": "fb7bb53e-b77b-4ab6-8274-9d420d3d73f3",
506
+ "collection_default": true,
507
+ "collection_label": "Boardwalk",
508
+ "palette_label": "Mixed categorical",
509
+ "palette_type": "Categorical",
510
+ "palette_colors": [
511
+ "#3EB0D5",
512
+ "#B1399E",
513
+ "#C2DD67",
514
+ "#592EC2",
515
+ "#4276BE",
516
+ "#72D16D",
517
+ "#FFD95F",
518
+ "#B32F37",
519
+ "#9174F0",
520
+ "#E57947",
521
+ "#75E2E2",
522
+ "#FBB555"
523
+ ]
524
+ },
525
+ "custom_color_enabled": true,
526
+ "custom_color": "#B1399E",
527
+ "show_single_value_title": true,
528
+ "show_comparison": false,
529
+ "comparison_type": "value",
530
+ "comparison_reverse_colors": false,
531
+ "show_comparison_label": true,
532
+ "type": "single_value",
533
+ "hidden_fields": [
534
+
535
+ ],
536
+ "y_axes": [
537
+
538
+ ]
539
+ },
540
+ "filter_config": null,
541
+ "visible_ui_sections": null,
542
+ "client_id": "4gUuOieukytTiuWigEBn7C",
543
+ "model": "aviation",
544
+ "dynamic_fields": null,
545
+ "query_timezone": "America/New_York"
546
+ },
547
+ "folder_id": "5",
548
+ "deleted": false,
549
+ "public": false
550
+ },
551
+ "look_id": "8",
552
+ "merge_result_id": null,
553
+ "note_display": null,
554
+ "note_state": null,
555
+ "note_text": null,
556
+ "query": null,
557
+ "query_id": null,
558
+ "refresh_interval": null,
559
+ "result_maker_id": "66",
560
+ "subtitle_text": null,
561
+ "title": null,
562
+ "title_hidden": false,
563
+ "title_text": null,
564
+ "type": "vis",
565
+ "rich_content_json": null,
566
+ "extension_id": null,
567
+ "alerts": [
568
+
569
+ ]
570
+ }
571
+ ],
572
+ "dashboard_filters": [
573
+ {
574
+ "name": "Date",
575
+ "title": "Date",
576
+ "type": "date_filter",
577
+ "explore": "",
578
+ "dimension": "",
579
+ "row": 0,
580
+ "allow_multiple_values": true,
581
+ "required": false,
582
+ "ui_config": null,
583
+ "model": "",
584
+ "listens_to_filters": [
585
+
586
+ ],
587
+ "default_value": "1 years"
588
+ },
589
+ {
590
+ "name": "State",
591
+ "title": "State",
592
+ "type": "field_filter",
593
+ "explore": "flights",
594
+ "dimension": "aircraft.state",
595
+ "row": 1,
596
+ "allow_multiple_values": true,
597
+ "required": false,
598
+ "ui_config": null,
599
+ "model": "aviation",
600
+ "listens_to_filters": [
601
+
602
+ ],
603
+ "default_value": ""
604
+ }
605
+ ],
606
+ "dashboard_layouts": [
607
+ {
608
+ "id": "17",
609
+ "dashboard_id": "17",
610
+ "type": "newspaper",
611
+ "active": true,
612
+ "column_width": null,
613
+ "width": null,
614
+ "dashboard_layout_components": [
615
+ {
616
+ "id": "58",
617
+ "dashboard_layout_id": "17",
618
+ "dashboard_element_id": "58",
619
+ "row": 0,
620
+ "column": 0,
621
+ "width": 8,
622
+ "height": 6
623
+ },
624
+ {
625
+ "id": "59",
626
+ "dashboard_layout_id": "17",
627
+ "dashboard_element_id": "59",
628
+ "row": 0,
629
+ "column": 8,
630
+ "width": 8,
631
+ "height": 6
632
+ },
633
+ {
634
+ "id": "60",
635
+ "dashboard_layout_id": "17",
636
+ "dashboard_element_id": "60",
637
+ "row": 0,
638
+ "column": 16,
639
+ "width": 8,
640
+ "height": 6
641
+ },
642
+ {
643
+ "id": "61",
644
+ "dashboard_layout_id": "17",
645
+ "dashboard_element_id": "61",
646
+ "row": 6,
647
+ "column": 0,
648
+ "width": 24,
649
+ "height": 12
650
+ },
651
+ {
652
+ "id": "68",
653
+ "dashboard_layout_id": "17",
654
+ "dashboard_element_id": "68",
655
+ "row": 18,
656
+ "column": 8,
657
+ "width": 8,
658
+ "height": 6
659
+ },
660
+ {
661
+ "id": "70",
662
+ "dashboard_layout_id": "17",
663
+ "dashboard_element_id": "70",
664
+ "row": 18,
665
+ "column": 0,
666
+ "width": 8,
667
+ "height": 6
668
+ }
669
+ ]
670
+ }
671
+ ],
672
+ "enable_viz_full_screen": true,
673
+ "filters_bar_collapsed": false,
674
+ "filters_location_top": true,
675
+ "load_configuration": "cache_run",
676
+ "lookml_link_id": null,
677
+ "show_filters_bar": null,
678
+ "show_title": null,
679
+ "text_tile_text_color": null,
680
+ "tile_background_color": null,
681
+ "tile_text_color": null,
682
+ "title_color": null,
683
+ "folder_id": "5",
684
+ "id": "17",
685
+ "deleted": false,
686
+ "appearance": null
687
+ }
@@ -0,0 +1,151 @@
1
+ #! /bin/bash
2
+
3
+ # The MIT License (MIT)
4
+
5
+ # Copyright (c) 2023 Mike DeAngelo Google, Inc.
6
+
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy of
8
+ # this software and associated documentation files (the "Software"), to deal in
9
+ # the Software without restriction, including without limitation the rights to
10
+ # use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11
+ # the Software, and to permit persons to whom the Software is furnished to do so,
12
+ # subject to the following conditions:
13
+
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19
+ # FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ # COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21
+ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
+ # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ SECRET_GITHUB_TOKEN=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
25
+ DATABASE_HOST=XXXXXXXXXXXXX
26
+ DATABASE_USERNAME=XXXXXXXXXXXXXX
27
+ DATABASE_PASSWORD=XXXXXXXXXXXXXX
28
+
29
+ echo '***************************************************************'
30
+ echo Login persistently
31
+ echo '***************************************************************'
32
+ gzr session login
33
+
34
+ echo '***************************************************************'
35
+ echo create and test the connection
36
+ echo '***************************************************************'
37
+ cat > Connection_faa_mysql.json <<HERE
38
+ {
39
+ "name": "faa",
40
+ "host": "$DATABASE_HOST",
41
+ "port": "3306",
42
+ "database": "flightstats",
43
+ "db_timezone": "UTC",
44
+ "query_timezone": "UTC",
45
+ "schema": null,
46
+ "max_connections": 30,
47
+ "ssl": false,
48
+ "verify_ssl": false,
49
+ "tmp_db_name": "tmp",
50
+ "pool_timeout": 120,
51
+ "sql_runner_precache_tables": true,
52
+ "sql_writing_with_info_schema": true,
53
+ "uses_tns": false,
54
+ "pdt_concurrency": 1,
55
+ "dialect_name": "mysql",
56
+ "username": "$DATABASE_USERNAME",
57
+ "password": "$DATABASE_PASSWORD"
58
+ }
59
+ HERE
60
+ gzr connection import Connection_faa_mysql.json --token_file
61
+ gzr connection test faa --token_file
62
+
63
+ echo '***************************************************************'
64
+ echo Change the session to dev mode
65
+ echo '***************************************************************'
66
+ gzr session get --token_file
67
+ gzr session update dev --token_file
68
+
69
+ echo '***************************************************************'
70
+ echo Import the project
71
+ echo '***************************************************************'
72
+ cat > Project_faa.json <<HERE
73
+ {
74
+ "name": "faa",
75
+ "uses_git": true
76
+ }
77
+ HERE
78
+ gzr project import Project_faa.json --token-file
79
+
80
+ echo '***************************************************************'
81
+ echo Create a deploy key and set it on the github repo for the project
82
+ echo '***************************************************************'
83
+ DEPLOY_KEY=$(gzr project deploy_key faa --token_file)
84
+ curl -L \
85
+ -X POST \
86
+ -H "Accept: application/vnd.github+json" \
87
+ -H "Authorization: Bearer $SECRET_GITHUB_TOKEN" \
88
+ -H "X-GitHub-Api-Version: 2022-11-28" \
89
+ https://api.github.com/repos/looker-open-source/faa/keys \
90
+ -d "{\"title\":\"test_key $(uuidgen)\",\"key\":\"$DEPLOY_KEY\",\"read_only\":false}"
91
+
92
+ echo '***************************************************************'
93
+ echo Set the project github connection
94
+ echo '***************************************************************'
95
+ cat > github_repo.json <<HERE
96
+ {
97
+ "git_remote_url": "git@github.com:looker-open-source/faa.git",
98
+ "git_service_name": "github"
99
+ }
100
+ HERE
101
+ gzr project update faa github_repo.json --token-file
102
+
103
+ echo '***************************************************************'
104
+ echo Check the project config
105
+ echo '***************************************************************'
106
+ gzr project cat faa --trim --token-file
107
+
108
+ echo '***************************************************************'
109
+ echo Checkout a shared branch
110
+ echo '***************************************************************'
111
+ gzr project checkout faa main --token_file
112
+
113
+ echo '***************************************************************'
114
+ echo Deploy to production
115
+ echo '***************************************************************'
116
+ gzr project deploy faa --token_file
117
+
118
+ echo '***************************************************************'
119
+ echo Configure lookml model
120
+ echo '***************************************************************'
121
+ cat > Model_faa.json <<HERE
122
+ {
123
+ "name": "aviation",
124
+ "project_name": "faa",
125
+ "unlimited_db_connections": false,
126
+ "allowed_db_connection_names": [
127
+ "faa"
128
+ ]
129
+ }
130
+ HERE
131
+ gzr model import Model_faa.json --token_file
132
+
133
+ echo '***************************************************************'
134
+ echo run a query against the model
135
+ echo '***************************************************************'
136
+ cat > query.json <<HERE
137
+ {
138
+ "model": "aviation",
139
+ "view": "aircraft_types",
140
+ "fields": ["aircraft_types.description","aircraft_types.count"],
141
+ "pivots": null,
142
+ "fill_fields": null,
143
+ "filters": null,
144
+ "filter_expression": null,
145
+ "sorts": [
146
+ "aircraft_types.description"
147
+ ],
148
+ "limit": "500"
149
+ }
150
+ HERE
151
+ gzr query runquery "$(cat query.json)"
@@ -42,12 +42,25 @@ module Gzr
42
42
  say_warning("options: #{@options.inspect}", output: output) if @options[:debug]
43
43
  with_session do
44
44
  read_file(@file) do |data|
45
- data.select! do |k,v|
46
- keys_to_keep('create_lookml_model').include? k
45
+ if !!cat_model(data[:name])
46
+ name = data[:name]
47
+ if !@options[:force]
48
+ raise Gzr::CLI::Error, "Model #{name} already exists\nUse --force if you want to overwrite it"
49
+ end
50
+ data.select! do |k,v|
51
+ keys_to_keep('update_lookml_model').include? k
52
+ end
53
+ model = update_model(data[:name],data)
54
+ output.puts "Updated model #{model[:name]}" unless @options[:plain]
55
+ output.puts model[:name] if @options[:plain]
56
+ else
57
+ data.select! do |k,v|
58
+ keys_to_keep('create_lookml_model').include? k
59
+ end
60
+ model = create_model(data)
61
+ output.puts "Created model #{model[:name]}" unless @options[:plain]
62
+ output.puts model[:name] if @options[:plain]
47
63
  end
48
- model = create_model(data)
49
- output.puts "Created model #{model[:name]}" unless @options[:plain]
50
- output.puts model[:name] if @options[:plain]
51
64
  end
52
65
  end
53
66
  end
@@ -67,6 +67,8 @@ module Gzr
67
67
  end
68
68
 
69
69
  desc 'import MODEL_FILE', 'Import a model configuration from a file containing json information'
70
+ method_option :force, type: :boolean,
71
+ desc: 'Overwrite an existing connection'
70
72
  method_option :help, aliases: '-h', type: :boolean,
71
73
  desc: 'Display usage information'
72
74
  def import(model_file)
@@ -65,5 +65,15 @@ module Gzr
65
65
  end
66
66
  end
67
67
 
68
+ def update_model(model_name,body)
69
+ begin
70
+ return @sdk.update_lookml_model(model_name,body)&.to_attrs
71
+ rescue LookerSDK::Error => e
72
+ say_error "Error running update_lookml_model(#{model_name},#{JSON.pretty_generate(body)})"
73
+ say_error e
74
+ raise
75
+ end
76
+ end
77
+
68
78
  end
69
79
  end
data/lib/gzr/version.rb CHANGED
@@ -20,5 +20,5 @@
20
20
  # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
22
  module Gzr
23
- VERSION = '0.3.8'.freeze
23
+ VERSION = '0.3.9'.freeze
24
24
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gazer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike DeAngelo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-16 00:00:00.000000000 Z
11
+ date: 2023-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty-reader
@@ -247,8 +247,10 @@ files:
247
247
  - ".github/scripts/parse_version.sh"
248
248
  - ".github/scripts/wait_for_looker.sh"
249
249
  - ".github/workflows/lint-pr.yml"
250
+ - ".github/workflows/p3-issue-label.yml"
250
251
  - ".github/workflows/release.yml"
251
252
  - ".github/workflows/ruby-ci.yml"
253
+ - ".github/workflows/triage-issue-label.yml"
252
254
  - ".gitignore"
253
255
  - ".rspec"
254
256
  - ".ruby-version"
@@ -263,6 +265,8 @@ files:
263
265
  - Rakefile
264
266
  - bin/console
265
267
  - bin/setup
268
+ - examples/Dashboard_17_FAA_KPIs.json
269
+ - examples/add_project.sh
266
270
  - exe/gzr
267
271
  - gzr.gemspec
268
272
  - lib/gzr.rb