I have a df that I read from a file
import uuid
df = spark.read.csv(path, sep="|", header=True)
Then I give it a UUID column
uuidUdf= udf(lambda : str(uuid.uuid4()),StringType())
df = df.withColumn("UUID",uuidUdf())
Now I create a view
view = df.createOrReplaceTempView("view")
Now I create two new dataframes that take data from the view, both dataframes will use the original UUID column.
df2 = spark.sql("select UUID from view")
df3 = spark.sql("select UUID from view")
All 3 dataframes will have different UUIDs, is there a way to keep them the same across each dataframe?