-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
855 monitor intersection movements for missing high volume movements #1025
855 monitor intersection movements for missing high volume movements #1025
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some questions on the view, possibility of using 1 function for two tables 🤔
SUM(v.volume) / ict.volume::numeric AS volume_frac | ||
FROM miovision_api.volumes AS v | ||
--anti join intersection_movements_denylist | ||
LEFT JOIN miovision_api.intersection_movements_denylist AS im_dl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are missing a where im_dl.blahblah is null
in the where clause for the anti join
@@ -0,0 +1,59 @@ | |||
CREATE OR REPLACE VIEW miovision_api.monitor_intersection_movements AS ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not what I exepcted! It's because SELECT now()::date AT TIME ZONE 'Canada/Eastern' - interval ' 100 days'
results in 2024-05-21 20:00:00
so the larger value had an extra 4 hrs of data.
|
||
DECLARE row_in_im numeric = ( | ||
SELECT COUNT(*) | ||
FROM miovision_api.intersection_movements_denylist AS im |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to make the table name a param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:gabe-approved:
28a0bcf
to
3408371
Compare
3408371
to
af8c29d
Compare
What this pull request accomplishes:
#airflow_pipelines-dev
)intersection_movements_denylist
with same structure as base ("allowlist")BEFORE INSERT
triggers on bothintersection_movements
andintersection_movements_denylist
to restrict inserting overlapping rows between the two. See it in action below.after insert
trigger (to insert padding values based on new inserts to intersection_movements) being developed in Miovision Aggregation Improvements (ATR view, intersection_movements AFTER INSERT trigger, unacceptable_gaps) #1024 which will make it easier to make additions to intersection_movements.Test new triggers using:
Issue(s) this solves:
What, in particular, needs to reviewed:
The two functions are basically the same, maybe I should make them take a table parameter...✅What needs to be done by a sysadmin after this PR is merged
E.g.: these tables need to be migrated/created in the production schema.