-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from miles-no/feat/databricks-storage-account
rename gold table to readable format
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Databricks notebook source | ||
from helpers.adls_utils import read_df_as_delta | ||
df_silver = read_df_as_delta("/silver/hav_temperature_projection_latest") | ||
display(df_silver) | ||
|
||
# COMMAND ---------- | ||
|
||
from helpers.adls_utils import save_df_as_csv | ||
save_df_as_csv(df_silver, "/gold/hav_temperature_projection_latest") | ||
|
||
# COMMAND ---------- | ||
|
||
from helpers.adls_utils import get_adls_file_path | ||
from datetime import datetime | ||
|
||
gold_path = f"{get_adls_file_path()}/gold" | ||
hav_gold_folder= f"{gold_path}/hav_temperature_projection_latest" | ||
files = dbutils.fs.ls(hav_gold_folder) | ||
|
||
old_file = [file.path for file in files if file.name.startswith("part-")][0] | ||
|
||
today = datetime.now().strftime("%Y-%m-%d") | ||
destination_path = f"{gold_path}/havtemp-pred-latest-{today}.csv" | ||
dbutils.fs.mv(old_file, destination_path) | ||
|
||
# COMMAND ---------- | ||
|
||
dbutils.fs.rm(hav_gold_folder, recurse=True) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters