Re: Looking for easy csv -> database
Ross Boylan sez:
} Does Debian have any database-like tool that could easily create a
} database from a CSV (plain text with delimeters) file?
} Databases: as I said, I didn't get very far. I have the sneeking
} suspicion gaby doesn't import from the rest of the world. Further,
} every time I've tried gaby in the past, its meager documentation and
} apparent bugginess have stymied me (though it seems to be in a much
} higher version number now). The gnome-db architecture looks as if it
} should, in principle, be able to take a plain text file as a data
} source, but I had no luck hooking this up. I also wonder any of the
} tools well extract the schema from the CSV file (column headers), or
} whether they all want me to define it in advance.
} I'm not sure if the problem here is the capabilities of the software,
} or my understanding of it. I'd appreciate any guidance.
I don't know of a good way of extracting a schema from column headers.
Among other things, that assumes magical knowledge of the column types
(e.g. integer, string, floating point). If you are willing to set up the
columns by hand (possibly using some GUI tool), however, postgresql has a
copy command which will import CSV files rather competently. See
for documentation of the command. Your command will probably look like:
COPY tablename FROM 'path/to/file' DELIMITER ',';
I believe the copy command can be issued using any interface (including a
graphical one), but I usually use the commandline interface, pgsql. Note
that the copy command is specific to postgresql, and is not standard SQL.