I'd like to write a script to convert from a relational database to a flat one and vice-versa. The database's rows mostly contain data from text input, but there are a few dropdown lists from the form that enter the primary IDs of a row from another table. Currently I have database rows that would look like say:
(1, 4, 2, 45.508582, -73.610102, 3) that I want turned into:
(1, Sherbrooke, "Park Frontenac", 45.508582, -73.610102, John, Doe) and this back to the above.
Some tables contain one column per primary ID (like city and park tables), but others have 2 or more (like the persons table).
What's the easiest way to write a script for this? I'm not comfortable with scripting outside of basic php, although I plan to start learning python soon.