How to save json data to Delta Table: ParseError on Insert
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2022 07:53 AM
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)
Labels:
- Labels:
-
Delta
-
Delta table
-
JSON Data
0 REPLIES 0
![](/skins/images/B38AF44D4BD6CE643D2A527BE673CCF6/responsive_peak/images/icon_anonymous_message.png)
![](/skins/images/B38AF44D4BD6CE643D2A527BE673CCF6/responsive_peak/images/icon_anonymous_message.png)