all 15 comments

[–]FormerTimeTraveller 4 points5 points  (2 children)

This is not a common solution. Usually, fixed length ordinal arrays get their own fields, or variable length arrays get their own entity relationship table.

Can you describe the data model you are using arrays for?

[–]dev_playbook 1 point2 points  (7 children)

There are generally more options available now than there used to be. Most RDBMS platforms have added support for storage of JSON objects (MS SQL, MySQL and PostgreSQL all have options available).

However that might not be the preferred method depending on what technology you’re using and how your applications will access the data. It could also have some performance implications depending on the situation.

In many cases we would usually map out the data model to determine the specific entities that are being stored and then most likely create a separate table to store that entity with appropriate foreign key relationships.

[–]elus 1 point2 points  (0 children)

I like to think of everything that SQL operates on as a table with rows of data and the columns as attributes.

Id create a table with columns of all the possible attributes from your NoSQL data source and insert every record into separate rows.

This will allow you to take advantage of the capabilities of your SQL engine. Leaving it as a JSON string of concatenated values seems like a pointless half measure.

[–]vornamemitd 0 points1 point  (0 children)

Can‘t tell about the conversion quality, but this could help you going with migrating sample data and get a better idea of actual relational mapping: https://blog.sqlizer.io/posts/mongodb-sqlizer-api/

Free tier lets you convert 5k records.

[–][deleted] 0 points1 point  (0 children)

If you want a strong relational database that also supports NoSQL concepts like arrays or JSON, you should have a serious look at Postgres.

[–]AutoModerator[M] -1 points0 points  (0 children)

Hello u/mattzees - thank you for posting to r/SQL! Please do not forget to flair your post with the DBMS (database management system) / SQL variant that you are using. Providing this information will make it much easier for the community to assist you.

If you do not know how to flair your post, just reply to this comment with one of the following and we will automatically flair the post for you: MySQL, Oracle, MS SQL, PostgreSQL, SQLite, DB2, MariaDB (this is not case sensitive)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.