Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature proposal: Map column names when exporting CSV #43

Open
DanielHeath opened this issue Jun 15, 2017 · 3 comments
Open

Feature proposal: Map column names when exporting CSV #43

DanielHeath opened this issue Jun 15, 2017 · 3 comments

Comments

@DanielHeath
Copy link
Contributor

DanielHeath commented Jun 15, 2017

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?

@diogob
Copy link
Owner

diogob commented Jun 15, 2017

Sorry, I don't follow you.
Could you paste a snippet of the desired code that you would like to use?

@DanielHeath
Copy link
Contributor Author

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.

@diogob
Copy link
Owner

diogob commented Jun 21, 2017

I see your point. It makes sense to have symetrical APIs on exports and imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants