Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 25 additions & 25 deletions scripts/jobs/parking/Parking_interim_cycle_hangar_waiting_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,45 @@
Parking_interim_cycle_hangar_waiting_list

Process the interim cycle hangar waiting list (supplied by Michael W) to add
additional fields (telephone Number, etc).
additional fields (telephone Number, etc).

23/12/2024 - Create SQL
*********************************************************************************/
With Interim_Wait as (
SELECT
distinct forename
,surname
,email
,party_id_to
,party_id
,cast(uprn as decimal) as uprn
,address1
,address2
,post_code
,x
,y
,lat
SELECT
distinct forename
,surname
,email
,party_id_to
,party_id
,cast(uprn as decimal) as uprn
,address1
,address2
,post_code
,x
,y
,lat
,long
FROM "parking-raw-zone".interim_cycle_wait_list
WHERE import_date = (select max(import_date)
FROM "parking-raw-zone".interim_cycle_wait_list
WHERE import_date = (select max(import_date)
from "parking-raw-zone".interim_cycle_wait_list)),

/*** Obtain the llpg data ***/
FULL_LLPG as (
SELECT * From "parking-refined-zone".spatially_enriched_liberator_permit_llpg
WHERE import_date = (select max(import_date)
WHERE import_date = (select max(import_date)
from "parking-refined-zone".spatially_enriched_liberator_permit_llpg)
AND address1 not like '%STREET RECORD%'),

STREET_LLPG as (
SELECT * From "parking-refined-zone".spatially_enriched_liberator_permit_llpg
WHERE import_date = (select max(import_date)
WHERE import_date = (select max(import_date)
from "parking-refined-zone".spatially_enriched_liberator_permit_llpg)
AND address1 like '%STREET RECORD%'),

/*** Obtain the Party details, where available ***/
Party as (
SELECT
SELECT
*
From "dataplatform-stg-liberator-raw-zone".liberator_licence_party
WHERE import_Date = format_datetime(current_date, 'yyyyMMdd')),
Expand All @@ -65,11 +65,11 @@
unsubscribed_emails as (
SELECT *,
ROW_NUMBER() OVER ( PARTITION BY email_address ORDER BY email_address DESC) row1
FROM "parking-raw-zone".parking_cycle_hangar_unsubscribed_emails
WHERE import_date = (select max(import_date)
from "parking-raw-zone".parking_cycle_hangar_unsubscribed_emails))
SELECT
FROM "parking-raw-zone".parking_parking_cycle_hangar_unsubscribed_emails
WHERE import_date = (select max(import_date)
from "parking-raw-zone".parking_parking_cycle_hangar_unsubscribed_emails))

SELECT
A.*, cast(D.telephone_number as varchar) as Telephone_Number, C.address2 as Street, B.housing_estate, E.email_address,

format_datetime(CAST(CURRENT_TIMESTAMP AS timestamp),
Expand Down
Loading