Skip to content

Commit ffdd2a9

Browse files
committed
Stubbed comprehensive import/insert script, need to merge with master to use functions added there.
1 parent b682684 commit ffdd2a9

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

meta-scripts/Data Store Table-Based.sql

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,37 @@ BEGIN
255255
END;
256256
$function$ LANGUAGE plpgsql;
257257

258+
--Complete import with subsequent drop of staging tables
259+
DROP FUNCTION IF EXISTS sql_import_sequences_and_insert_into_tables(boolean, text[], int[], text);
260+
CREATE FUNCTION sql_import_sequences_and_insert_into_tables(exec boolean = FALSE, stusab_criteria text[] = ARRAY['%'],
261+
seq_criteria int[] = ARRAY[-1], actions text = 'atem'
262+
) RETURNS text AS $function$
263+
DECLARE
264+
sql TEXT := '';
265+
bool_large_geo BOOLEAN;
266+
bool_small_geo BOOLEAN;
267+
bool_estimate BOOLEAN;
268+
bool_moe BOOLEAN;
269+
sql_large_geo TEXT;
270+
sql_small_geo TEXT;
271+
sql_large_geo_moe TEXT;
272+
sql_small_geo_moe TEXT;
273+
seq_criteria2 int[];
274+
filename_part TEXT :='';
275+
BEGIN
276+
EXECUTE 'SELECT ' || current_schema() || '.get_refyear_period();' INTO filename_part;
277+
IF seq_criteria = ARRAY[-1] THEN
278+
seq_criteria2 := (SELECT array_agg(seq) FROM vw_sequence);
279+
ELSE
280+
seq_criteria2 := seq_criteria;
281+
END IF;
282+
283+
SELECT sql_drop_import_tables
284+
285+
END;
286+
$function$ LANGUAGE plpgsql;
287+
288+
258289
--Maintenance Functions
259290
DROP FUNCTION IF EXISTS sql_truncate_storage_tables(boolean, int[], text);
260291
CREATE FUNCTION sql_truncate_storage_tables(exec boolean = FALSE, seq_criteria int[] = ARRAY[-1], actions text = 'em') RETURNS text AS $function$

0 commit comments

Comments
 (0)