Loading JSON Data into StarRocks from Local Disk, from S3 Bucket or Postman #25504
Closed
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This tutorial describes how you can loading JSON data using the "routine load" feature.
Prerequisites
For this tutorial you need to:
A StarRocks or CelerData database cluster
This is out of scope for the tutorial.
Create the Sample CSV Data File
Create a
example2.json
file with the following dataAnd a
example3.json
Access to an Object Store and upload the JSON data file
This is out of scope for the tutorial. Upload the
example3.json
file. Please store the URI to the file and any credential needed to login for future usage.Create a Database and Create a Database Table
Load the json file from HTTP
So in this example, we're going to do transformation/functions during the loading. You'll notice that the json file keys don't match up with the database. First we're going to do jsonpaths to map json fields to database columns. You'll notice that "name" field will match with column "city" however I mapped "code" field to "tmp_id" column that doesn't exist. I'm actually assigning the "code" field to a variable. At the end of the column when everything has been mapped, I now assign the real "id". See the picture for a visual representation of the assignment.
Here is the output.
Load the json from HTTP
Here's another more complex example can be used in the Loading JSON and AVRO data from Confluent Cloud Kafka into StarRocks tutorial at #22791
Load the JSON file from S3
There is an RFE for this feature. Please vote for this feature at #25505
Load JSON data using Postman
Beta Was this translation helpful? Give feedback.
All reactions