Reputation: 1965
I'm having trouble copying data from a production MySQL server to a development SQLite3 file (so that I have real data to play with on development machine). I've found tons of resources around the 'net on how to convert from MySQL to SQLite3, most of which were bash scripts with elaborate sed filters, but none worked (the most common problem was syntax issues upon import).
Anyway, then I stumbled upon YamlDB, and I thought "Why, of course! Let Rails do the conversion for me!" Well, this doesn't work either because all of the NULL fields (which are represented in the YAML file as !!null
) end up being imported into the SQLite3 database exactly as "--- !!null" instead of actual NULLs. I seem to be the only person with this problem, as there were no mentions of it in the GitHub issues queue.
I even tried the workaround for using syck instead of psych (found in this SO question), but it made no difference.
So my question is this: does ANYONE know of a SIMPLE way to export data from one rails database for importing into another, regardless of database kind? And by "simple", I mean a few commands at the console, or whatever.
Upvotes: 0
Views: 1242
Reputation: 46703
Look into taps @ http://github.com/ricardochimal/taps
It will dump your MySQL db into a local sqlite db and is relatively simple to use.
From the comments: If you get an error stating schema parsing returned no columns, table probably doesn't exist
then you need to specify an absolute path to the sqlite3 db instead of a relative one
Upvotes: 2