|
1 | 1 | sql_config = {'person_reshape': { |
2 | | - 'sql': """SELECT *, cast(date_parse(substr(startdate, 1, 10), '%Y-%m-%d') as date) as startdate_parsed, cast(date_parse(substr(enddate, 1, 10), '%Y-%m-%d') as date) as enddate_parsed, cast(date_parse(substr(dateofbirth, 1, 10), '%Y-%m-%d') as date) as dateofbirth_parsed FROM "housing-refined-zone"."person_reshape" where import_date=(select max(import_date) from "housing-refined-zone"."person_reshape") and enddate is NULL and type in ('Secure', 'Introductory')"""}, |
| 2 | + 'sql': """SELECT *, cast(date_parse(substr(startdate, 1, 10), '%Y-%m-%d') as date) as startdate_parsed, cast(date_parse(substr(enddate, 1, 10), '%Y-%m-%d') as date) as enddate_parsed, cast(date_parse(substr(dateofbirth, 1, 10), '%Y-%m-%d') as date) as dateofbirth_parsed FROM "housing-refined-zone"."person_reshape" where import_date=(select max(import_date) from "housing-refined-zone"."person_reshape") and enddate is NULL and type in ('Secure', 'Introductory')""", |
| 3 | + 'id_field': 'person_id'}, |
3 | 4 | 'tenure_reshape': { |
4 | | - 'sql': """SELECT * FROM "housing-refined-zone"."tenure_reshape" where import_date>'20240412' and import_date=(select max(import_date) from "housing-refined-zone"."tenure_reshape" where import_date>'20240412') and isterminated=False and description in ('Secure', 'Introductory')"""}, |
| 5 | + 'sql': """SELECT * FROM "housing-refined-zone"."tenure_reshape" where import_date>'20240412' and import_date=(select max(import_date) from "housing-refined-zone"."tenure_reshape" where import_date>'20240412') and isterminated=False and description in ('Secure', 'Introductory')""", |
| 6 | + 'id_field': 'tenure_id'}, |
5 | 7 | 'contacts_reshape': { |
6 | | - 'sql': """SELECT id, targetid, createdat, contacttype, subtype, value, lastmodified, targettype, isactive, person_id, import_date FROM "housing-refined-zone"."contacts_reshape" where import_date=(select max(import_date) from "housing-refined-zone"."contacts_reshape") and isactive=True"""}, |
| 8 | + 'sql': """SELECT id, targetid, createdat, contacttype, subtype, value, lastmodified, targettype, isactive, person_id, import_date FROM "housing-refined-zone"."contacts_reshape" where import_date=(select max(import_date) from "housing-refined-zone"."contacts_reshape") and isactive=True""", |
| 9 | + 'id_field': 'id'}, |
7 | 10 | 'housing_homeowner_record_sheet': { |
8 | | - 'sql': """SELECT * FROM "housing-raw-zone"."housing_homeowner_record_sheet" where import_date=(select max(import_date) from "housing-raw-zone"."housing_homeowner_record_sheet")"""}, |
| 11 | + 'sql': """SELECT * FROM "housing-raw-zone"."housing_homeowner_record_sheet" where import_date=(select max(import_date) from "housing-raw-zone"."housing_homeowner_record_sheet")""", |
| 12 | + 'id_field': 'property_no'}, |
9 | 13 | 'housing_dwellings_list': { |
10 | | - 'sql': """SELECT * FROM "housing-raw-zone"."housing_dwellings_list" where import_date=(select max(import_date) from "housing-raw-zone"."housing_homeowner_record_sheet")"""} |
| 14 | + 'sql': """SELECT * FROM "housing-raw-zone"."housing_dwellings_list" where import_date=(select max(import_date) from "housing-raw-zone"."housing_homeowner_record_sheet")""", |
| 15 | + 'id_field': 'property_dwelling_reference_number'}, |
| 16 | + 'assets_reshape': { |
| 17 | + 'sql': """SELECT * FROM "housing-refined-zone"."assets_reshape" where import_date=(select max(import_date) from "housing-refined-zone"."assets_reshape") and assettype = 'Dwelling'""", |
| 18 | + 'id_field': 'asset_id'} |
11 | 19 | } |
12 | 20 |
|
13 | 21 | table_list = ['person_reshape', 'tenure_reshape', 'contacts_reshape', 'housing_homeowner_record_sheet', |
14 | | - 'housing_dwellings_list'] |
| 22 | + 'housing_dwellings_list', 'assets_reshape'] |
| 23 | + |
15 | 24 | partition_keys = ['import_year', 'import_month', 'import_day', 'import_date'] |
| 25 | + |
| 26 | +dq_dimensions_map = {'expect_column_value_lengths_to_be_between': 'ACCURACY', |
| 27 | + 'expect_column_values_to_be_unique': 'UNIQUENESS', |
| 28 | + 'expect_column_values_to_match_regex': 'VALIDITY', |
| 29 | + 'expect_column_values_to_be_in_set': 'CONSISTENCY', |
| 30 | + 'expect_select_column_values_to_be_unique_within_record': 'UNIQUENESS', |
| 31 | + 'expect_column_values_to_not_be_null': 'COMPLETENESS', |
| 32 | + 'expect_column_values_to_be_between': 'VALIDITY' |
| 33 | + } |
0 commit comments