Import MySQL dump into R (without requiring MySQL server)

后端 未结 3 1256
迷失自我
迷失自我 2020-12-11 23:35

Packages like RMySQL and sqldf allow one to interface with local or remote database servers. I\'m creating a portable project which involves import

3条回答
  •  一整个雨季
    2020-12-11 23:42

    I don't think you will find a way to import a sql dump (which contains multiple tables with references) and then perform arbitrary sql queries on them within R. This would basically require the R package to run a complete database server (compatible with the one creating the dump) within R.

    I would suggest exporting the tables/select statements you need as CSV from your database (see here). If you can only work from the dump and don't want to setup a server for the conversion you could use some simple regular expressions to turn the insert statements in your dump into a bunch of CSV files for the tables using a tool of your choosing like sed or awk (or even R as suggested by the other answer but that might be rather slow for this file size).

提交回复
热议问题