-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add new Littlepay columns + correct mistyped columns #2996
Changes from all commits
3cf0994
8af7f2a
f7d4ab5
e6f0234
81b52ff
56d5c41
f9f3b2c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,11 +6,14 @@ clean_columns AS ( | |
SELECT | ||
{{ trim_make_empty_string_null('participant_id') }} AS participant_id, | ||
{{ trim_make_empty_string_null('product_id') }} AS product_id, | ||
{{ trim_make_empty_string_null('previous_version_id') }} AS previous_version_id, | ||
{{ trim_make_empty_string_null('original_version_id') }} AS original_version_id, | ||
{{ trim_make_empty_string_null('product_code') }} AS product_code, | ||
{{ trim_make_empty_string_null('product_description') }} AS product_description, | ||
{{ trim_make_empty_string_null('product_type') }} AS product_type, | ||
{{ trim_make_empty_string_null('activation_type') }} AS activation_type, | ||
{{ trim_make_empty_string_null('product_status') }} AS product_status, | ||
{{ trim_make_empty_string_null('superseded') }} AS superseded, | ||
{{ trim_make_empty_string_null('created_date') }} AS created_date, | ||
{{ trim_make_empty_string_null('capping_type') }} AS capping_type, | ||
{{ safe_cast('multi_operator', type_boolean()) }} AS multi_operator, | ||
|
@@ -23,12 +26,24 @@ clean_columns AS ( | |
{{ safe_cast('scheduled_end_date_time', 'DATE') }} AS scheduled_end_date_time, | ||
{{ safe_cast('all_day', type_boolean()) }} AS all_day, | ||
{{ trim_make_empty_string_null('weekly_cap_start_day') }} AS weekly_cap_start_day, | ||
{{ trim_make_empty_string_null('weekly_cap_end_day') }} AS weekly_cap_end_day, | ||
{{ safe_cast('number_of_days_in_cap_window', type_float()) }} AS number_of_days_in_cap_window, | ||
{{ safe_cast('capping_duration', type_float()) }} AS capping_duration, | ||
{{ safe_cast('number_of_transfer', type_float()) }} AS number_of_transfer, | ||
{{ trim_make_empty_string_null('capping_time_zone') }} AS capping_time_zone, | ||
{{ safe_cast('capping_overlap', 'TIME') }} AS capping_overlap, | ||
{{ safe_cast('capping_overlap_time', 'TIME') }} AS capping_overlap_time, | ||
{{ trim_make_empty_string_null('capping_application_level') }} AS capping_application_level, | ||
{{ safe_cast('route_capping_enabled', type_boolean()) }} AS route_capping_enabled, | ||
{{ trim_make_empty_string_null('routes') }} AS routes, | ||
{{ safe_cast('zoned_capping_enabled', type_boolean()) }} AS zoned_capping_enabled, | ||
{{ trim_make_empty_string_null('zoned_capping_mode') }} AS zoned_capping_mode, | ||
{{ trim_make_empty_string_null('zoned_capping_pricing_type') }} AS zoned_capping_pricing_type, | ||
{{ trim_make_empty_string_null('on_peak_zones') }} AS on_peak_zones, | ||
{{ trim_make_empty_string_null('off_peak_zones') }} AS off_peak_zones, | ||
{{ safe_cast('incentive_enabled', type_boolean()) }} AS incentive_enabled, | ||
{{ trim_make_empty_string_null('incentive_type') }} AS incentive_type, | ||
{{ trim_make_empty_string_null('discount_qualifier') }} AS discount_qualifier, | ||
{{ trim_make_empty_string_null('configuration') }} AS configuration, | ||
CAST(_line_number AS INTEGER) AS _line_number, | ||
`instance`, | ||
extract_filename, | ||
|
@@ -37,14 +52,16 @@ clean_columns AS ( | |
ts, | ||
-- hash all content not generated by us to enable deduping full dup rows | ||
-- hashing at this step will preserve distinction between nulls and empty strings in case that is meaningful upstream | ||
{{ dbt_utils.generate_surrogate_key(['participant_id', 'product_id', 'product_code', | ||
'product_description', 'product_type', 'activation_type', 'product_status', | ||
{{ dbt_utils.generate_surrogate_key(['participant_id', 'product_id', 'previous_version_id', 'original_version_id', 'product_code', | ||
'product_description', 'product_type', 'activation_type', 'product_status', 'superseded', | ||
'created_date', 'capping_type', 'multi_operator', 'capping_start_time', | ||
'capping_end_time', 'rules_transaction_types', 'rules_default_limit', | ||
'rules_max_fare_value', 'scheduled_start_date_time', 'scheduled_end_date_time', | ||
'all_day', 'weekly_cap_start_day', 'number_of_days_in_cap_window', | ||
'capping_duration', 'number_of_transfer', 'capping_time_zone', 'capping_overlap', | ||
'capping_application_level']) }} AS _content_hash, | ||
'all_day', 'weekly_cap_start_day', 'weekly_cap_end_day', 'number_of_days_in_cap_window', | ||
'capping_duration', 'number_of_transfer', 'capping_time_zone', 'capping_overlap_time', | ||
'capping_application_level', 'route_capping_enabled', 'routes', 'zoned_capping_enabled', 'zoned_capping_mode', | ||
'zoned_capping_pricing_type', 'on_peak_zones', 'off_peak_zones', 'incentive_enabled', 'incentive_type', | ||
'discount_qualifier', 'configuration']) }} AS _content_hash, | ||
FROM source | ||
), | ||
|
||
|
@@ -62,11 +79,14 @@ stg_littlepay__product_data AS ( | |
SELECT | ||
participant_id, | ||
product_id, | ||
previous_version_id, | ||
original_version_id, | ||
product_code, | ||
product_description, | ||
product_type, | ||
activation_type, | ||
product_status, | ||
superseded, | ||
created_date, | ||
capping_type, | ||
multi_operator, | ||
|
@@ -79,12 +99,24 @@ stg_littlepay__product_data AS ( | |
scheduled_end_date_time, | ||
all_day, | ||
weekly_cap_start_day, | ||
weekly_cap_end_day, | ||
number_of_days_in_cap_window, | ||
capping_duration, | ||
number_of_transfer, | ||
capping_time_zone, | ||
capping_overlap, | ||
capping_overlap_time, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems to always be null, is this field present in the actual files we're getting? |
||
capping_application_level, | ||
route_capping_enabled, | ||
routes, | ||
zoned_capping_enabled, | ||
zoned_capping_mode, | ||
zoned_capping_pricing_type, | ||
on_peak_zones, | ||
off_peak_zones, | ||
incentive_enabled, | ||
incentive_type, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always null, same question |
||
discount_qualifier, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always null, same question |
||
configuration, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always null, same question |
||
_line_number, | ||
`instance`, | ||
extract_filename, | ||
|
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.
incentive_product_id
seems to be null in 100% of our data. Do we actually get data with this column? (i.e., is it actually present in any files we're currently getting?)