-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
example.sh
executable file
·36 lines (32 loc) · 942 Bytes
/
example.sh
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
#!/bin/sh
set -e
set -o pipefail
2>&1 echo "importing into PostgreSQL:"
./cli.js --ignore-unsupported --require-dependencies --trips-without-shape-id --silent \
node_modules/sample-gtfs-feed/gtfs/*.txt \
| sponge | psql -b
2>&1 echo "\nfetching a connection during DST switch:"
psql -c "$(cat <<- EOM
SELECT
trip_id, route_id,
from_stop_id, t_departure,
stop_sequence,
to_stop_id, t_arrival
FROM connections
WHERE trip_id = 'during-dst-1'
AND t_departure > '2019-03-31T01:55+01' AND t_departure < '2019-03-31T03:00+02'
-- AND route_id = 'D'
-- AND from_stop_id = 'airport'
EOM)"
2>&1 echo "\nfetching the departure at the same time:"
psql -c "$(cat <<- EOM
SELECT
trip_id, route_id,
stop_id, t_departure,
stop_sequence
FROM arrivals_departures
WHERE trip_id = 'during-dst-1'
AND t_departure > '2019-03-31T01:55+01' AND t_departure < '2019-03-31T03:00+02'
-- AND route_id = 'D'
-- AND stop_id = 'airport'
EOM)"