Is it possible to transfer data from MongoDB to SQL-Server?

I searched around, I found that there are ways to transfer / synchronize data from sql server to mongodb. I also know that Mongodb contains collections instead of tables, and the data is stored differently. I want to know if it is possible to transfer data from mongodb to sql server? If so, what tools / topics should I learn.

+6
source share
3 answers

Of course this is possible, but you will need to find a way to force the flexibility of a db document, such as MongoDB, into RDBMS, such as SQL Server.

This means that you need to determine how you want to handle the missing fields (will it be NULL in the db column? Or the default value?) And other things that usually don't work well in a relational database.

It is said that you can use an ETL tool that can connect to both databases, SSIS can be an example if you want to stay in the MicroSoft world (you can check this MongoDB Data Import using SSIS 2012 , or you can use the open source tool e.g. Talend Big Data Integration , which has a connector for MongoDB (and a course for SQL Server).

+7
source

Cannot directly move data from MongoDB to SQL Server. Since MongoDB data is not relational, any such move should include defining the target model of relational data in SQL Server, and then designing a transformation that can receive data in MongoDB and transform it into the target data model.

Most ETL tools, such as Kettle or Talend, can help you with this process, or if you are a glutton for punishment, you can simply write gobs code.

Keep in mind that if you need this conversion process to be online or applied several times, you may need to configure it for any small changes to the structure or data types stored in MongoDB. For example, if a developer adds a new field to a document within a collection, your ETL process will need to be rethought (perhaps a new data model, a new conversion process, etc.).

If you are not sold on SQL Server, I would suggest you consider Postgres, because there is a widely used open source tool called MoSQL , which was designed specifically to synchronize the Postgres database with the MongoDB database. It is mainly used for reporting purposes (obtaining data from MongoDB and in the DBMS so that analytical or reporting tools can be superimposed on top).

MoSQL is widely implemented and well supported, and for data with bad torture you always have the opportunity to use the Postgres JSON data type, which is not supported by any analytics or reporting tools, but at least allows you to directly request data in Postgres. In addition, and now my own personal bias is emerging, Postgres is 100% open source, and SQL Server is 100% closed .:-)

Finally, if you are only extracting data from MongoDB to facilitate analytics or reporting, you should consider SlamData , an open source project that I started last year that allows you to run ANSI SQL on MongoDB using 100% database execution data (mostly a compiler of the SQL-to-MongoDB API). Most people using this project seem to use it for analytics or use case reports. The advantage is that it works with the data as it is, so you do not need to perform ETL, and, of course, it is always updated because it works directly on MongoDB. The disadvantage is that no one has yet built an ODBC / JDBC driver for it, so you cannot directly connect BI tools to SlamData.

Good luck

+4
source

There is a tool provided by MongoDB called mongoexport and it is able to export csv files. These csv files can be easily imported into MySQL. Good luck

+3
source

Source: https://habr.com/ru/post/986363/


All Articles