Skip to content

Commit cdc1675

Browse files
authored
Update rentsense_to_refined_and_landing.py
Another change to the dates.
1 parent 1fefb02 commit cdc1675

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

scripts/jobs/rentsense_to_refined_and_landing.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from awsglue.transforms import DropFields
1010
from awsglue.utils import getResolvedOptions
1111
from pyspark.context import SparkContext
12-
from pyspark.sql.functions import col, current_date, date_sub, lit, to_date, trim
12+
from pyspark.sql.functions import col, current_date, date_sub, lit, to_date, trim, to_timestamp
1313

1414
from scripts.helpers.helpers import (
1515
PARTITION_KEYS,
@@ -560,11 +560,11 @@
560560
F.to_date(col("startOfTenureDate"), "yyyy-MM-dd").alias("date"),
561561
).drop("startOfTenureDate").withColumnRenamed("date", "startOfTenureDate")
562562

563-
accounts.select(
564-
col("endoftenuredate"),
565-
F.to_date(col("endoftenuredate"), "yyyy-MM-dd").alias("date"),
566-
).drop("endoftenuredate").withColumnRenamed("date", "endoftenuredate")
567-
563+
accounts = accounts.withColumn(
564+
"endoftenuredate",
565+
to_date(to_timestamp(col("endoftenuredate"), "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"))
566+
)
567+
568568
accounts = accounts.drop("uh_ten_ref")
569569

570570
accounts = accounts.withColumn("prop_ref", F.trim(F.col("property_reference")))

0 commit comments

Comments
 (0)