comparison etl/src/main/resources/sql/flys-common.properties @ 5838:5aa05a7a34b7

Rename modules to more fitting names.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 25 Apr 2013 15:23:37 +0200
parents flys-aft/src/main/resources/sql/flys-common.properties@11fba4dabe05
children 33e514a0c6b7
comparison
equal deleted inserted replaced
5837:d9901a08d0a6 5838:5aa05a7a34b7
1 select.rivers = \
2 SELECT r.id AS id, r.name AS name, min(wcv.position) AS min_km, max(wcv.position) AS max_km \
3 FROM rivers r \
4 JOIN wsts w ON r.id = w.river_id \
5 JOIN wst_columns wc ON w.id = wc.wst_id \
6 JOIN wst_column_values wcv ON wcv.wst_column_id = wc.id \
7 WHERE w.kind = 0 \
8 GROUP BY r.id, r.name
9 select.gauges = \
10 SELECT id, name, official_number \
11 FROM gauges \
12 WHERE river_id = :river_id
13 next.gauge.id = \
14 SELECT NEXTVAL('GAUGES_ID_SEQ') AS gauge_id
15 insert.gauge = \
16 INSERT INTO gauges (id, name, river_id, station, aeo, official_number, datum) \
17 VALUES(:id, :name, :river_id, :station, :aeo, :official_number, :datum)
18 select.timeintervals = \
19 SELECT id, start_time, stop_time FROM time_intervals
20 next.timeinterval.id = \
21 SELECT NEXTVAL('TIME_INTERVALS_ID_SEQ') AS time_interval_id
22 insert.timeinterval = \
23 INSERT INTO time_intervals (id, start_time, stop_time) \
24 VALUES (:id, :start_time, :stop_time)
25 next.discharge.id = \
26 SELECT NEXTVAL('DISCHARGE_TABLES_ID_SEQ') AS discharge_table_id
27 insert.dischargetable = \
28 INSERT INTO discharge_tables \
29 (id, gauge_id, description, bfg_id, kind, time_interval_id) \
30 VALUES (:id, :gauge_id, :description, :bfg_id, 1, :time_interval_id)
31 select.discharge.table.values = \
32 SELECT id, w, q FROM discharge_table_values WHERE table_id = :table_id
33 next.discharge.table.values.id = \
34 SELECT NEXTVAL('DISCHARGE_TABLE_VALUES_ID_SEQ') AS discharge_table_values_id
35 insert.discharge.table.value = \
36 INSERT INTO discharge_table_values (id, table_id, w, q) \
37 VALUES (:id, :table_id, :w, :q)
38 delete.discharge.table.value = \
39 DELETE FROM discharge_table_values WHERE id = :id
40 select.gauge.discharge.tables = \
41 SELECT \
42 dt.id AS id, \
43 dt.description AS description, \
44 ti.start_time AS start_time, \
45 ti.stop_time AS stop_time, \
46 dt.bfg_id AS bfg_id \
47 FROM discharge_tables dt \
48 LEFT OUTER JOIN time_intervals ti ON dt.time_interval_id = ti.id \
49 WHERE gauge_id = :gauge_id
50 select.gauge.master.discharge.table = \
51 SELECT \
52 dt.id AS id, \
53 dt.bfg_id AS bfg_id \
54 FROM discharge_tables dt JOIN gauges g ON dt.gauge_id = g.id \
55 WHERE g.id = :gauge_id AND dt.kind = 0
56 update.bfg.id.discharge.table = \
57 UPDATE discharge_tables SET bfg_id = :bfg_id WHERE id = :id

http://dive4elements.wald.intevation.org