postgres-copy
postgres-copy copied to clipboard
Feature proposal: Map column names when exporting CSV
I'm seeing an issue where column names are:
A) converted to lowercase (they are uppercase in the SQL) B) cannot be remapped in ruby code (without hacking around in the enumerator).
Would a PR to add the map: {} syntax to CSV exports be mergeable?
Sorry, I don't follow you. Could you paste a snippet of the desired code that you would like to use?
Lets say you have CSV imports and exports, and want round-tripping to work.
You export with:
Foo.select('bar as Baz').copy_to_string
then import with:
Foo.copy_from filename, :map => {'Baz' => 'bar'}
However, the CSV from copy_to_string has a header row of baz, not Baz.
I see your point. It makes sense to have symetrical APIs on exports and imports.