cancel
Showing results for 
Search instead for 
Did you mean: 
Community Platform 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

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group