Last active
August 31, 2021 08:35
-
-
Save nescobar/af2aa30bf25c82e296d8c1e50ebb5bc8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Get run_id from temporary view | |
runId = spark.table("run_id").head()["run_id"] | |
runId = re.findall(r'\d+', runId)[0] | |
runId = int(runId) | |
data = [[runId]] | |
# Get notebook name | |
notebook_path = spark.table("notebook_path").head()["notebook_path"] | |
path_split = notebook_path.split("/") | |
nb_name = path_split[len(path_split)-1] | |
# Create global temporary view with run_id_notebook-name | |
df = spark.createDataFrame(data, schema=schema) | |
df.createOrReplaceGlobalTempView("run_id_{}".format(nb_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment