Export JSON data and load into a Relational Database Export JSON data and load into a Relational Database json json

Export JSON data and load into a Relational Database


we have our mongo DB which stores JSON data. We wanted to migrated data to Redshift for some querying purposes.

We used mongoexport csv to create csv from mongo table and uploaded it to S3. We created corresponding relational schema in Redshift and used copy commands to load these csv data from s3 to redshift.

We can use java apis to query mongo and create and upload csv to s3. The same can be loaded to redshift.

The real problem is since we use mongo (json) or NoSQL we might have different number of columns for given object which belongs to same table ( as we JSON) , but in Redshift we have fixed number of columns per table So in such cases you need to create all possible columns and load data . For those objects which does not have all columns we can populate null values for them.