Skip to content
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

fix(databricks): fix time format for use in file name #16

Merged
merged 1 commit into from
Oct 8, 2024
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
9 changes: 6 additions & 3 deletions databricks/Havvarsel - Ingest as Bronze.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,17 @@ def fetch_ocean_temperature_preditions(depth_index, lat, lon):
# COMMAND ----------

import requests
from pyspark.sql.functions import lit, current_timestamp
from pyspark.sql.functions import lit, current_timestamp, date_format
from datetime import datetime
from helpers.adls_utils import save_df_as_delta, get_adls_folder_path, connect_to_adls
connect_to_adls()

fetch_time = current_timestamp()
bronze_df_file_name = f"bronze/hav_temperature_projection_{fetch_time}" # have a new bronze for each fetch date
fetch_time = datetime.utcnow()
formatted_time = fetch_time.strftime("%Y-%m-%dT%H%M%S")

bronze_df_file_name = f"bronze/hav_temperature_projection_{formatted_time}" # have a new bronze for each fetch date

print(bronze_df_file_name)

dbutils.fs.rm(f"{get_adls_folder_path()}/{bronze_df_file_name}", recurse=True) # delete old in order to remove duplicates

Expand Down