cancel
Showing results for 
Search instead for 
Did you mean: 
Community Discussions
Connect with fellow community members to discuss general topics related to the Databricks platform, industry trends, and best practices. Share experiences, ask questions, and foster collaboration within the community.
cancel
Showing results for 
Search instead for 
Did you mean: 

dataframe column structtype metadata not getting saved to unitycatalog

vk217
Contributor

I have the below schema

schema = StructType([
StructField(
name="Test",
dataType=StringType(),
nullable=False,
metadata={
"description": "This is to test metadata description."
}
)
])

data = [('Test1',), ('Test2',), ('Test3',)]
df = spark.createDataFrame(data, schema=schema)

and I am writing to datalake 

df.write.mode("overwrite").format("delta").saveAsTable(table_name)

Now when I read the from the unity catalog table and try to access the metadata, I don't see it.

 

from pyspark.sql import functions as F
df = spark.read.format("delta").table(table_name)
print(df.schema['Test'].metadata)

 

Where is the metadata from that column stored? I have checked information_schema.columns as well and I don't see it.

 

 

 

 

 

0 REPLIES 0
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!