cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Schema enforcement from External Location

Dp15
Contributor

Hi, 
This might be a silly question to ask but is it possible to enforce schema on a table created from external location, I am trying to create a table from a s3 location and my command looks like this


query = """CREATE TABLE IF NOT EXISTS {}
USING PARQUET
LOCATION '{}'""".format(raw_table,s3_bucket_location)

but I am not happy with the schema it infers from the parquet, Is there a way I can enforce schema on this table by changing some column types ? I tried by add the 
options ( schema = <schema_definition> ) to the create command, that didnt work.

1 ACCEPTED SOLUTION

Accepted Solutions

feiyun0112
Honored Contributor
2 REPLIES 2

feiyun0112
Honored Contributor

Kaniz_Fatma
Community Manager
Community Manager

I want to express my gratitude for your effort in selecting the most suitable solution. It's great to hear that your query has been successfully resolved. Thank you for your contribution.




 

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