cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to save json data to Delta Table: ParseError on Insert

Gabriel0007
New Contributor III

I'm trying to save the returned json data from a requests API call to a Delta Table. I get a ParseError when I INSERT the response object which is in json format. The error shows the json data and a marker that states a ' or } or ) is missing. I validated the json data. Why is the INSERT process trying to parse the json data? Is there another way to INSERT the data?

json_data = response.text

query = f"INSERT INTO database.table VALUES ('{json_data}')"

spark.sql(query)

0 REPLIES 0
Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.