From e62098bdab55a6d9019bee104a23fde7cf2e17af Mon Sep 17 00:00:00 2001 From: gabrielwol <80077912+gabrielwol@users.noreply.github.com> Date: Fri, 26 Jul 2024 18:23:54 +0000 Subject: [PATCH] #868, #879 fluff --- .../function-aggregate-volumes_15min_mvt.sql | 2 +- .../function/function-clear-volumes_15min_mvt.sql | 4 ++-- ...unction-create_mm_nested_volumes_partitions.sql | 14 +++++++++----- ...unction-create_yyyy_volumes_15min_partition.sql | 14 +++++++++----- .../sql/views/create-view-volumes_15min_tmc.sql | 5 +++-- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/volumes/miovision/sql/function/function-aggregate-volumes_15min_mvt.sql b/volumes/miovision/sql/function/function-aggregate-volumes_15min_mvt.sql index 3f3cffbac..c094317ed 100644 --- a/volumes/miovision/sql/function/function-aggregate-volumes_15min_mvt.sql +++ b/volumes/miovision/sql/function/function-aggregate-volumes_15min_mvt.sql @@ -123,7 +123,7 @@ OWNER TO miovision_admins; GRANT EXECUTE ON FUNCTION miovision_api.aggregate_15_min_mvt(date, date, integer []) TO miovision_api_bot; -COMMENT ON FUNCTION miovision_api.aggregate_15_min_mvt(date, date, integer []) +COMMENT ON FUNCTION miovision_api.aggregate_15_min_mvt(date, date, integer []) IS '''Aggregates valid movements from `miovision_api.volumes` in to `miovision_api.volumes_15min_mvt_unfiltered` as 15 minute turning movement counts (TMC) bins and fills in gaps with 0-volume bins. Also updates foreign key in `miovision_api.volumes`. Takes an diff --git a/volumes/miovision/sql/function/function-clear-volumes_15min_mvt.sql b/volumes/miovision/sql/function/function-clear-volumes_15min_mvt.sql index 62aca86d2..ad5131c45 100644 --- a/volumes/miovision/sql/function/function-clear-volumes_15min_mvt.sql +++ b/volumes/miovision/sql/function/function-clear-volumes_15min_mvt.sql @@ -57,5 +57,5 @@ GRANT EXECUTE ON FUNCTION miovision_api.clear_15_min_mvt(timestamp, timestamp, i TO miovision_admins; COMMENT ON FUNCTION miovision_api.clear_15_min_mvt(timestamp, timestamp, integer []) -IS '''Clears data from `miovision_api.volumes_15min_mvt_unfiltered` in order to facilitate re-pulling. -`intersections` param defaults to all intersections.'''; \ No newline at end of file +IS '''Clears data from `miovision_api.volumes_15min_mvt_unfiltered` in order to facilitate +re-pulling. `intersections` param defaults to all intersections.'''; \ No newline at end of file diff --git a/volumes/miovision/sql/function/function-create_mm_nested_volumes_partitions.sql b/volumes/miovision/sql/function/function-create_mm_nested_volumes_partitions.sql index 0d4f1893a..2a0d9e6a8 100644 --- a/volumes/miovision/sql/function/function-create_mm_nested_volumes_partitions.sql +++ b/volumes/miovision/sql/function/function-create_mm_nested_volumes_partitions.sql @@ -1,7 +1,8 @@ CREATE OR REPLACE FUNCTION miovision_api.create_mm_nested_volumes_partitions( base_table text, year_ integer, - mm_ integer) + mm_ integer +) RETURNS void LANGUAGE 'plpgsql' SECURITY DEFINER @@ -43,8 +44,11 @@ $BODY$; COMMENT ON FUNCTION miovision_api.create_mm_nested_volumes_partitions(text, integer, integer) IS '''Create a new month partition under the parent year table `base_table`. Only to be used for -miovision_api `volumes_15min_mvt_unfiltered` table. -Example: `SELECT miovision_api.create_yyyy_volumes_partition(''volumes_15min_mvt_unfiltered'', 2023)`'''; +miovision_api `volumes_15min_mvt_unfiltered` table. Example: +`SELECT miovision_api.create_yyyy_volumes_partition(''volumes_15min_mvt_unfiltered'', 2023)`'''; -ALTER FUNCTION miovision_api.create_mm_nested_volumes_partitions(text, integer, integer) OWNER TO miovision_admins; -GRANT EXECUTE ON FUNCTION miovision_api.create_mm_nested_volumes_partitions(text, integer, integer) TO miovision_api_bot; \ No newline at end of file +ALTER FUNCTION miovision_api.create_mm_nested_volumes_partitions(text, integer, integer) +OWNER TO miovision_admins; + +GRANT EXECUTE ON FUNCTION miovision_api.create_mm_nested_volumes_partitions(text, integer, integer) +TO miovision_api_bot; \ No newline at end of file diff --git a/volumes/miovision/sql/function/function-create_yyyy_volumes_15min_partition.sql b/volumes/miovision/sql/function/function-create_yyyy_volumes_15min_partition.sql index b58484ce1..17629f14c 100644 --- a/volumes/miovision/sql/function/function-create_yyyy_volumes_15min_partition.sql +++ b/volumes/miovision/sql/function/function-create_yyyy_volumes_15min_partition.sql @@ -1,6 +1,7 @@ CREATE OR REPLACE FUNCTION miovision_api.create_yyyy_volumes_15min_partition( base_table text, - year_ integer) + year_ integer +) RETURNS void LANGUAGE 'plpgsql' SECURITY DEFINER @@ -39,8 +40,11 @@ $BODY$; COMMENT ON FUNCTION miovision_api.create_yyyy_volumes_15min_partition(text, integer) IS '''Create a new year partition under the parent table `base_table`. Only to be used for -miovision_api `volumes_15min_mvt_unfiltered` table. -Example: `SELECT miovision_api.create_yyyy_volumes_partition(''volumes_15min_mvt_unfiltered'', 2023)`'''; +miovision_api `volumes_15min_mvt_unfiltered` table. Example: +`SELECT miovision_api.create_yyyy_volumes_partition(''volumes_15min_mvt_unfiltered'', 2023)`'''; -ALTER FUNCTION miovision_api.create_yyyy_volumes_15min_partition(text, integer) OWNER TO miovision_admins; -GRANT EXECUTE ON FUNCTION miovision_api.create_yyyy_volumes_15min_partition(text, integer) TO miovision_api_bot; \ No newline at end of file +ALTER FUNCTION miovision_api.create_yyyy_volumes_15min_partition(text, integer) +OWNER TO miovision_admins; + +GRANT EXECUTE ON FUNCTION miovision_api.create_yyyy_volumes_15min_partition(text, integer) +TO miovision_api_bot; \ No newline at end of file diff --git a/volumes/miovision/sql/views/create-view-volumes_15min_tmc.sql b/volumes/miovision/sql/views/create-view-volumes_15min_tmc.sql index 1e4ee6864..f55b441c3 100644 --- a/volumes/miovision/sql/views/create-view-volumes_15min_tmc.sql +++ b/volumes/miovision/sql/views/create-view-volumes_15min_tmc.sql @@ -18,7 +18,8 @@ IS 'miovision_api.volumes_15min_mvt_filtered, but only including turning movemen GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO bdit_humans; GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO bdit_bots; -GRANT TRIGGER, REFERENCES, SELECT ON TABLE miovision_api.volumes_15min_tmc TO bdit_humans WITH GRANT OPTION; +GRANT TRIGGER, REFERENCES, SELECT ON TABLE miovision_api.volumes_15min_tmc +TO bdit_humans WITH GRANT OPTION; GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO dbadmin; GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO miovision_admins; -GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO rds_superuser WITH GRANT OPTION; +GRANT ALL ON TABLE miovision_api.volumes_15min_tmc TO rds_superuser WITH GRANT OPTION; \ No newline at end of file