Skip to content

Commit 1635d96

Browse files
committed
Add workaround for working with dates in GX. Add expectation to person_reshape suite. Amend sql query for person_reshape.
1 parent 0a134e0 commit 1635d96

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

scripts/helpers/housing_gx_dq_inputs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
sql_config = {'person_reshape': {
22
'sql': """SELECT *, substr(startdate, 1, 10) as startdate_parsed, substr(enddate, 1, 10) as enddate_parsed,
3-
substr(dateofbirth, 1, 10) as dateofbirth_parsed
4-
FROM "housing-refined-zone"."person_reshape" WHERE import_date = (SELECT max(import_date) FROM "housing-refined-zone"."person_reshape"
5-
) AND enddate IS NULL AND type IN ('Secure', 'Introductory') and substr(dateofbirth, 1, 10) between '1850-01-01' and '2100-01-01' and substr(startdate, 1, 10) between '1900-01-01' and '2100-01-01'""",
3+
substr(dateofbirth, 1, 10) 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') and substr(dateofbirth, 1, 10) between '1850-01-01' and '2100-01-01' and substr(startdate, 1, 10) between '1900-01-01' and '2100-01-01'""",
64
'id_field': 'person_id'},
75
'tenure_reshape': {
86
'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')""",

0 commit comments

Comments
 (0)