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

Support for normalizing column names. #525

Closed
wants to merge 1 commit into from
Closed

Support for normalizing column names. #525

wants to merge 1 commit into from

Conversation

pudo
Copy link

@pudo pudo commented Jan 24, 2016

This still has the dependencies, since I can't come up with an alternative way of actually doing the normalisation.

Fixes #396, replaces #505.

@danvk
Copy link

danvk commented Oct 7, 2016

Is there any interest in reviving this? I'd love to be able to run:

csvsql --db '...' --insert *.csv

to import a collection of CSVs into Postgres. But my CSVs have a capitalized header row, which means I'll need to do some monkey-patching to get easy-to-work-with tables in Postgres.

(Update) In case it helps anyone else, you can lowercase all column names in a Postgres database after you import using this magical incantation from Stack Overflow:

\t on
select 'ALTER TABLE '||'"'||table_name||'"'||' RENAME COLUMN '||'"'||column_name||'"'||' TO ' || lower(column_name)||';' 
from information_schema.columns 
where table_schema = 'public' and lower(column_name) != column_name
\g /tmp/go_to_lower
\i /tmp/go_to_lower

@jpmckinney
Copy link
Member

Closing as diverged too far. Leaving #396 open.

@jpmckinney jpmckinney closed this Dec 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants