PostgreSQL data

#1

Hello, New here.

I have 20 million records in a PostgreSQL database spread acrosss a number of tables.
I’m willing to adjust the schemas - I’m handy with SQL.

My big goal - is to access this data via Parse. The docs are silent on how to connect Parse with PostgreSQL.

Any guidance?

#2

This is actually not the most common usage case for Parse Server (connecting it to a legacy database) and that’s why you can’t find so much information about it. Anyway, I think it can be done. I’ve never tried it before to be very honest, but here’s what I’d do:

  1. Backup of the current data :slight_smile:
  2. Launch a Parse Server connecting to the database. In order to use the Postgres storage adapter, please take a look here (you just need to pass a valid Postgres URI in the databaseURI option when initializing Parse server
    –> If you had a small database, I’d suggested here to basically write a script to read the data from each of your tables and insert in Parse Server through the API. Below is another suggestion. Maybe you can use the suggestion below for big tables, and insert through the Parse API small tables.
  3. Launch a Parse Dashboard connecting to this Parse Server
  4. Use the Parse Dashboard browser to create a new schema for each of the tables you have
  5. Use the Parse Dashboard API console to test each of the tables. You will find some problems here and you will need to fix one by one. Here it goes some issues that I think can arise:
    • objectID: I don’t know your database tables’ id format, but you will probably need to make it compatible to Parse.
    • createdAt and updatedAt: You will probably need to create these two columns for each of your tables.
    • other field types: You will have to make sure that you are selecting the right types when creating your schema in Parse to be compatible with the data you already have.

If possible, please update your progress on this. This is something that can be interesting for the community and maybe generate new features ideas.

#3

Thanks.
I’m a SQL hack so changing schema to fit is not an issue.
Will take a look

1 Like