-
Notifications
You must be signed in to change notification settings - Fork 0
/
rpt_groups_csv.bash
executable file
·60 lines (58 loc) · 1.69 KB
/
rpt_groups_csv.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
cd /Sites/cold
# {
# "Scope": "",
# "activity": "active",
# "alternative": [
# "RSI"
# ],
# "clgid": "Resnick-Sustainability-Institute",
# "date": "10/23/18",
# "description": "",
# "email": "joy@caltech.edu",
# "end_date": "",
# "grid": "",
# "include_in_feeds": true,
# "is_approx_end": false,
# "is_approx_start": false,
# "isni": "",
# "name": "Resnick Sustainability Institute",
# "parent": "Jonas Peters",
# "pi": "",
# "prefix": "",
# "ringold": "",
# "ror": "",
# "start_date": "",
# "updated": "3/26/20",
# "viaf": "",
# "website": "https://resnick.caltech.edu/"
# }
cat <<SQL>groups_rpt.sql
select json_object(
'key', src->'clgid',
'name', src->'name',
'alternative', replace(replace(replace(replace(json_quote(src->'alternative'), '","', '; '), '["', ''), '"]', ''), '[]', ''),
'email', src->'email',
'date', src->'date',
'description', src->'description',
'start', src->'start_date',
'approx_start', src->'is_approx_start',
'activity', src->'activity',
'end', src->'end_date',
'appox_end', src->'is_approx_end',
'website', src->'website',
'pi', src->'pi',
'parent', src->'parent',
'prefix', src->'prefix',
'grid', src->'grid',
'isni', src->'isni',
'ringold', src->'ringold',
'viaf', src->'viaf',
'ror', src->'ror',
'updated', src->'updated',
'Scope', src->'Scope'
)
from groups
order by src->'name'
SQL
dsquery -csv "key,name,alternative,email,date,description,start,approx_start,activity,end,approx_end,website,pi,parent,prefix,grid,isni,ringold,viaf,ror,updated,Scope" -sql groups_rpt.sql groups.ds >groups.csv