Re: Utility that creates table schema from csv data?

From: "Reid Thompson" <Reid(dot)Thompson(at)ateb(dot)com>
To: "Richard Huxton" <dev(at)archonet(dot)com>, "CSN" <cool_screen_name90001(at)yahoo(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Utility that creates table schema from csv data?
Date: 2005-09-13 13:12:17
Message-ID: F71C0DC6B4FD3648815AAA7F969E35290194F2C3@sr002-2kexc.ateb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
> CSN wrote:
>> Probably wishful thinking, but who knows - maybe
>> there's something in contrib! I have a bunch of csv
>> data with the field names specified on the first line
>> of the various files. Is there any such utility that
>> will create a table schema using the field names AND
>> look through the data and determine what data types
>> each field should be?
>
> I'm not sure that's possible in a general sense. Is 123 text or a
> number? How do I prove it one way or another?
>
> However, if you were happy to end up with "good enough" types (i.e.
> might end up using text instead of a more specific type), and
> know that
> data was representative then it shouldn't be too tricky to write some
> pattern-matching Perl to do the job.

ruby's auto-typing might do the same, w/o having to write
pattern-matching.

reid

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2005-09-13 13:54:02 Re: Replication
Previous Message Stephane Bortzmeyer 2005-09-13 11:01:13 Re: Email Verfication Regular Expression