Thread: What text format is this and can I import it into Postgres?

What text format is this and can I import it into Postgres?

From
Mike Christensen
Date:
I'd like to import this data into a Postgres database:

http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip

However, I'm not quite sure what format this is.  It's definitely not
CSV.  Here's an example of a few rows:

~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH
SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER
OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01004~^~0100~^~Cheese,
blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01005~^~0100~^~Cheese,
brick~^~CHEESE,BRICK~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01006~^~0100~^~Cheese,
brie~^~CHEESE,BRIE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01007~^~0100~^~Cheese,
camembert~^~CHEESE,CAMEMBERT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01008~^~0100~^~Cheese,
caraway~^~CHEESE,CARAWAY~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
~01009~^~0100~^~Cheese,
cheddar~^~CHEESE,CHEDDAR~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
~01010~^~0100~^~Cheese,
cheshire~^~CHEESE,CHESHIRE~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
~01011~^~0100~^~Cheese,
colby~^~CHEESE,COLBY~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87

Is there an easy way to get this into PG, or a tool I can download for
this, or do I need to parse it myself with a script or something?
Thanks!


Re: What text format is this and can I import it into Postgres?

From
Rob Sargent
Date:
On 08/22/2012 06:23 PM, Mike Christensen wrote:
> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>
> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER
> OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01004~^~0100~^~Cheese,
> blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01005~^~0100~^~Cheese,
> brick~^~CHEESE,BRICK~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01006~^~0100~^~Cheese,
> brie~^~CHEESE,BRIE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01007~^~0100~^~Cheese,
> camembert~^~CHEESE,CAMEMBERT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01008~^~0100~^~Cheese,
> caraway~^~CHEESE,CARAWAY~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01009~^~0100~^~Cheese,
> cheddar~^~CHEESE,CHEDDAR~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01010~^~0100~^~Cheese,
> cheshire~^~CHEESE,CHESHIRE~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01011~^~0100~^~Cheese,
> colby~^~CHEESE,COLBY~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>
> Is there an easy way to get this into PG, or a tool I can download for
> this, or do I need to parse it myself with a script or something?
> Thanks!
>
>

Looks CSVish to me with '^' as C (after all it means Character Separated
Data)

rjs



Re: What text format is this and can I import it into Postgres?

From
Edson Richter
Date:
For me seems to be CSV, but you have "~" in place of double quotes, and
"^" as separator.

Regards,

Edson.


Em 22/08/2012 21:23, Mike Christensen escreveu:
> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>
> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER
> OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01004~^~0100~^~Cheese,
> blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01005~^~0100~^~Cheese,
> brick~^~CHEESE,BRICK~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01006~^~0100~^~Cheese,
> brie~^~CHEESE,BRIE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01007~^~0100~^~Cheese,
> camembert~^~CHEESE,CAMEMBERT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01008~^~0100~^~Cheese,
> caraway~^~CHEESE,CARAWAY~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01009~^~0100~^~Cheese,
> cheddar~^~CHEESE,CHEDDAR~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01010~^~0100~^~Cheese,
> cheshire~^~CHEESE,CHESHIRE~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01011~^~0100~^~Cheese,
> colby~^~CHEESE,COLBY~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>
> Is there an easy way to get this into PG, or a tool I can download for
> this, or do I need to parse it myself with a script or something?
> Thanks!
>
>



Re: What text format is this and can I import it into Postgres?

From
Bosco Rama
Date:
On 08/22/12 17:23, Mike Christensen wrote:
> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>
> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87

<http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/sr24_doc.pdf>

Section "Relation Files" (Logical page 25)

HTH

Bosco.


Re: What text format is this and can I import it into Postgres?

From
Rob Sargent
Date:
On 08/22/2012 06:23 PM, Mike Christensen wrote:
> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>
> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER
> OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01004~^~0100~^~Cheese,
> blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01005~^~0100~^~Cheese,
> brick~^~CHEESE,BRICK~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01006~^~0100~^~Cheese,
> brie~^~CHEESE,BRIE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01007~^~0100~^~Cheese,
> camembert~^~CHEESE,CAMEMBERT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01008~^~0100~^~Cheese,
> caraway~^~CHEESE,CARAWAY~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01009~^~0100~^~Cheese,
> cheddar~^~CHEESE,CHEDDAR~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01010~^~0100~^~Cheese,
> cheshire~^~CHEESE,CHESHIRE~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01011~^~0100~^~Cheese,
> colby~^~CHEESE,COLBY~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>
> Is there an easy way to get this into PG, or a tool I can download for
> this, or do I need to parse it myself with a script or something?
> Thanks!
>
>
oops, more like a funky string sep
~^~ between values, single tilde for star of record
the nasty bit will be to undo the exponentiation

rjs



Re: What text format is this and can I import it into Postgres?

From
Mike Christensen
Date:
On Wed, Aug 22, 2012 at 5:34 PM, Bosco Rama <postgres@boscorama.com> wrote:
> On 08/22/12 17:23, Mike Christensen wrote:
>> I'd like to import this data into a Postgres database:
>>
>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>
>> However, I'm not quite sure what format this is.  It's definitely not
>> CSV.  Here's an example of a few rows:
>>
>> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
>> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>
> <http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/sr24_doc.pdf>
>
> Section "Relation Files" (Logical page 25)

Okay so is there a way to import "Relational Files" into Postgres?

The alternative would be to download the Excel version, then Save as
CSV, and import into Postgres via the COPY command.

Mike


Re: What text format is this and can I import it into Postgres?

From
David Johnston
Date:
The first delimiter is ~^~ (tilde-carat-tilde)

The last field is itself delimited with just ^ (carat)

I would use text parsing tools to do this myself though various commands in PosegreSQL could be combined to get the
desiredresult.  The last 4 numbers (second parse) should probably be stored in a numeric[] 

Look at COPY and regexp_matches()

David J.


On Aug 22, 2012, at 20:23, Mike Christensen <mike@kitchenpc.com> wrote:

> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>
> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01002~^~0100~^~Butter, whipped, with salt~^~BUTTER,WHIPPED,WITH
> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01003~^~0100~^~Butter oil, anhydrous~^~BUTTER
> OIL,ANHYDROUS~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01004~^~0100~^~Cheese,
> blue~^~CHEESE,BLUE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01005~^~0100~^~Cheese,
> brick~^~CHEESE,BRICK~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01006~^~0100~^~Cheese,
> brie~^~CHEESE,BRIE~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01007~^~0100~^~Cheese,
> camembert~^~CHEESE,CAMEMBERT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01008~^~0100~^~Cheese,
> caraway~^~CHEESE,CARAWAY~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01009~^~0100~^~Cheese,
> cheddar~^~CHEESE,CHEDDAR~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01010~^~0100~^~Cheese,
> cheshire~^~CHEESE,CHESHIRE~^~~^~~^~~^~~^0^~~^6.38^4.27^8.79^3.87
> ~01011~^~0100~^~Cheese,
> colby~^~CHEESE,COLBY~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>
> Is there an easy way to get this into PG, or a tool I can download for
> this, or do I need to parse it myself with a script or something?
> Thanks!
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general


Re: What text format is this and can I import it into Postgres?

From
Mike Christensen
Date:
On Wed, Aug 22, 2012 at 5:38 PM, Mike Christensen <mike@kitchenpc.com> wrote:
> On Wed, Aug 22, 2012 at 5:34 PM, Bosco Rama <postgres@boscorama.com> wrote:
>> On 08/22/12 17:23, Mike Christensen wrote:
>>> I'd like to import this data into a Postgres database:
>>>
>>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>>
>>> However, I'm not quite sure what format this is.  It's definitely not
>>> CSV.  Here's an example of a few rows:
>>>
>>> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
>>> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>>
>> <http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/sr24_doc.pdf>
>>
>> Section "Relation Files" (Logical page 25)
>
> Okay so is there a way to import "Relational Files" into Postgres?
>
> The alternative would be to download the Excel version, then Save as
> CSV, and import into Postgres via the COPY command.

Oh, also if anyone knows of a way to export an Access database to
Postgres, that might be helpful. I don't have a copy of Access.


Re: What text format is this and can I import it into Postgres?

From
John R Pierce
Date:
On 08/22/12 5:23 PM, Mike Christensen wrote:
> I'd like to import this data into a Postgres database:
>
> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>
> However, I'm not quite sure what format this is.  It's definitely not
> CSV.  Here's an example of a few rows:
>

this worked for me... (in psql)

create table test (f1 text,f2 text,f3 text,f4 text,f5 text,f6 text,f7
text,f8 text,f9 text);
  \copy test from DATA_SRC.txt with delimiter '^' csv quote as '~'
select * from test;
-[ RECORD 1

]-----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------
f1 | D1066
f2 | G.V. Mann
f3 | The Health and Nutritional status of Alaskan Eskimos.
f4 | 1962
f5 | American Journal of Clinical Nutrition
f6 | 11
f7 |
f8 | 31
f9 | 76
-[ RECORD 2

]-----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------
f1 | D1073
f2 | J.P. McBride, R.A. Maclead
f3 | Sodium and potassium in fish from the Canadian Pacific coast.
f4 | 1956
f5 | Journal of the American Dietetic Association
f6 | 32
f7 |
f8 | 636
f9 | 638
-[ RECORD 3

]-----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------
f1 | D1107
f2 | M.E. Stansby
f3 | Chemical Characteristics of fish caught in the northwest Pacific
Oceans.
f4 | 1976
f5 | Marine Fish Rev.
f6 | 38
f7 | 9
f8 | 1
f9 | 11
.........



obviously, use better field  names...

--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



Re: What text format is this and can I import it into Postgres?

From
Bosco Rama
Date:

On 08/22/12 17:41, Mike Christensen wrote:
> On Wed, Aug 22, 2012 at 5:38 PM, Mike Christensen <mike@kitchenpc.com> wrote:
>> On Wed, Aug 22, 2012 at 5:34 PM, Bosco Rama <postgres@boscorama.com> wrote:
>>> On 08/22/12 17:23, Mike Christensen wrote:
>>>> I'd like to import this data into a Postgres database:
>>>>
>>>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>>>
>>>> However, I'm not quite sure what format this is.  It's definitely not
>>>> CSV.  Here's an example of a few rows:
>>>>
>>>> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
>>>> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>>>
>>> <http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/sr24_doc.pdf>
>>>
>>> Section "Relation Files" (Logical page 25)
>>
>> Okay so is there a way to import "Relational Files" into Postgres?

Hmm.  with a little sed or awk you could convert them into CSV for copy.  Or
you could even just use copy with the '^' as delimiter and massage the tables
afterwards.

There is also pgloader which may help.  I haven't used it but it gets mentioned
here quite a lot.

>> The alternative would be to download the Excel version, then Save as
>> CSV, and import into Postgres via the COPY command.

That's the lowest effort course you have, I think.

> Oh, also if anyone knows of a way to export an Access database to
> Postgres, that might be helpful. I don't have a copy of Access.

mdb-tools?   <http://mdbtools.sourceforge.net/>

Not sure if it's up to date.

There are a few other things mentioned here (some links no longer work :-( ) :
<http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#Microsoft_Access>

Bosco.


Re: What text format is this and can I import it into Postgres?

From
John R Pierce
Date:
On 08/22/12 5:40 PM, David Johnston wrote:
> The first delimiter is ~^~ (tilde-carat-tilde)
>
> The last field is itself delimited with just ^ (carat)

simpler than that, ~ is the QUOTE character, ^ is the field delimiter :)



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



Re: What text format is this and can I import it into Postgres?

From
Mike Christensen
Date:
On Wed, Aug 22, 2012 at 5:57 PM, John R Pierce <pierce@hogranch.com> wrote:
> On 08/22/12 5:23 PM, Mike Christensen wrote:
>>
>> I'd like to import this data into a Postgres database:
>>
>>
>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>
>> However, I'm not quite sure what format this is.  It's definitely not
>> CSV.  Here's an example of a few rows:
>>
>
> this worked for me... (in psql)
>
> create table test (f1 text,f2 text,f3 text,f4 text,f5 text,f6 text,f7
> text,f8 text,f9 text);
>  \copy test from DATA_SRC.txt with delimiter '^' csv quote as '~'
> select * from test;
> -[ RECORD 1
>
]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1066
> f2 | G.V. Mann
> f3 | The Health and Nutritional status of Alaskan Eskimos.
> f4 | 1962
> f5 | American Journal of Clinical Nutrition
> f6 | 11
> f7 |
> f8 | 31
> f9 | 76
> -[ RECORD 2
>
]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1073
> f2 | J.P. McBride, R.A. Maclead
> f3 | Sodium and potassium in fish from the Canadian Pacific coast.
> f4 | 1956
> f5 | Journal of the American Dietetic Association
> f6 | 32
> f7 |
> f8 | 636
> f9 | 638
> -[ RECORD 3
>
]-----------------------------------------------------------------------------------------------------------------------
> ----------------------------------------------------------
> f1 | D1107
> f2 | M.E. Stansby
> f3 | Chemical Characteristics of fish caught in the northwest Pacific
> Oceans.
> f4 | 1976
> f5 | Marine Fish Rev.
> f6 | 38
> f7 | 9
> f8 | 1
> f9 | 11
> .........
>
>
>
> obviously, use better field  names...

SWEET!

This is exactly what I needed.  Thanks so much..  Already got the
first table imported..

Mike


Re: What text format is this and can I import it into Postgres?

From
Adrian Klaver
Date:
On 08/22/2012 05:41 PM, Mike Christensen wrote:
> On Wed, Aug 22, 2012 at 5:38 PM, Mike Christensen <mike@kitchenpc.com> wrote:
>> On Wed, Aug 22, 2012 at 5:34 PM, Bosco Rama <postgres@boscorama.com> wrote:
>>> On 08/22/12 17:23, Mike Christensen wrote:
>>>> I'd like to import this data into a Postgres database:
>>>>
>>>> http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/dnload/sr24.zip
>>>>
>>>> However, I'm not quite sure what format this is.  It's definitely not
>>>> CSV.  Here's an example of a few rows:
>>>>
>>>> ~01001~^~0100~^~Butter, salted~^~BUTTER,WITH
>>>> SALT~^~~^~~^~Y~^~~^0^~~^6.38^4.27^8.79^3.87
>>>
>>> <http://www.ars.usda.gov/SP2UserFiles/Place/12354500/Data/SR24/sr24_doc.pdf>
>>>
>>> Section "Relation Files" (Logical page 25)
>>
>> Okay so is there a way to import "Relational Files" into Postgres?
>>
>> The alternative would be to download the Excel version, then Save as
>> CSV, and import into Postgres via the COPY command.
>
> Oh, also if anyone knows of a way to export an Access database to
> Postgres, that might be helpful. I don't have a copy of Access.

There is MDB tools. It is only works with older versions of Access and
is limited in what it can do:

http://mdbtools.sourceforge.net/

Do you have a Windows machine available? Depending on what is installed
there may be an Access ODBC driver available that will allow you jump
through an intermediate step i.e. Excel.

>
>


--
Adrian Klaver
adrian.klaver@gmail.com


Re: What text format is this and can I import it into Postgres?

From
John R Pierce
Date:
On 08/22/12 7:17 PM, Mike Christensen wrote:
> This is exactly what I needed.  Thanks so much..  Already got the
> first table imported..

I think would use 'TEXT' for the string fields, INTEGER for the whole
numbers and NUMERIC for the fractional ones...
once you have the data imported, and define the appropriate field of
each table as its PRIMARY KEY, you should be able to do a wide range of
joins to collect specific sorts of data.



--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast



Re: What text format is this and can I import it into Postgres?

From
Mike Christensen
Date:
>> This is exactly what I needed.  Thanks so much..  Already got the
>> first table imported..
>
>
> I think would use 'TEXT' for the string fields, INTEGER for the whole
> numbers and NUMERIC for the fractional ones...
> once you have the data imported, and define the appropriate field of each
> table as its PRIMARY KEY, you should be able to do a wide range of joins to
> collect specific sorts of data.

The PDF that's included in the ZIP file actually has all the data
types and precisions, primary keys, and relations.  I just copied that
for my table schemas.  I decided not to define any FK constraints
because I want to easily zap all the data and re-import it when new
versions of the database are released, and I never change any of the
data myself.

Mike


Re: What text format is this and can I import it into Postgres?

From
Thomas Kellerer
Date:
Mike Christensen, 23.08.2012 02:41:
> Oh, also if anyone knows of a way to export an Access database to
> Postgres, that might be helpful. I don't have a copy of Access.

If you have a Windows box, you can try SQL Workbench/J. Even though it is a Java application it can connect to an
Accessdatabase using the JDBC/ODBC bridge. As every Windows box has an ODBC driver for Access built-in you don't need
anyadditional drivers (you do need a Java runtime obviously). 

An example connection URL is shown in the manual: http://www.sql-workbench.net/manual/profiles.html#odbc

On a 64bit System setting up the ODBC connection can be tricky though as both 32bit and 64bit drivers are registered I
believe.The Java Runtime has to have the same "bits" as the ODBC driver in order to work. 

I have no idea if using JDBC/ODBC would work on a Unix/Linux box though.

SQL Workbench can export any database it can connect to, to various output formats
(http://www.sql-workbench.net/manual/command-export.html).The text/csv exports can be imported into Postgres. 

Regards
Thomas

(I'm the author of SQL Workbench/J)