Forum: Ruby on Rails Rails - Postgres - importing data

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-05-30 17:16
(Received via mailing list)
I am writing a application where there is a lot of data in an old
Filemaker program that I am going to need to do a 1 time import...1 main
table and 2 related tables. I can get the data from Filemaker into a dbf
or csv or Excel file without problem.

Is anyone aware of a utility for postgresql or a rails plug-in that
might make this easier? I am worried about Rails import since I can't
see a way of importing the related tables while keeping the 'id' from
the primary table.

Any suggestions would be appreciated

Craig
0ccfc4935cd968d289decc405604a2ca?d=identicon&s=25 Matthew Law (Guest)
on 2006-05-30 17:28
(Received via mailing list)
How much is a lot? - The easiest way to go with pgsql is to try and
export to tab separated format for each table and use COPY to squirt it
into postgres.  You may need to do some munging of the original data to
clean it up, for which you can use Ruby or Perl but other than that you
should have no problems.  If it is a LOT of data then excel will puke at
about 65,000 rows... which is at least 935,000 rows short of "a lot"
IMHO :-)

Matt.
Ba0b6f35c33d3275de38f31bdd848396?d=identicon&s=25 Jeremy Burks (jrun)
on 2006-05-30 17:29
Craig White wrote:
> I am writing a application where there is a lot of data in an old
> Filemaker program that I am going to need to do a 1 time import...1 main
> table and 2 related tables. I can get the data from Filemaker into a dbf
> or csv or Excel file without problem.
>
> Is anyone aware of a utility for postgresql or a rails plug-in that
> might make this easier? I am worried about Rails import since I can't
> see a way of importing the related tables while keeping the 'id' from
> the primary table.
>
> Any suggestions would be appreciated
>
> Craig

checkout "psql \copy"
(http://www.postgresql.org/docs/8.1/interactive/app-psql.html)
C1e5a9e9344b6d31b9df7303e6dc378a?d=identicon&s=25 Craig White (Guest)
on 2006-05-30 17:34
(Received via mailing list)
OK - a little  ;-)

The main db has 150 or so columns but the number of records is small by
that yardstick.

I was thinking that I would do it exactly as you stated but wanted to
canvas for other possibilities.

Thanks

Craig
Ba0b6f35c33d3275de38f31bdd848396?d=identicon&s=25 Jeremy Burks (jrun)
on 2006-05-30 17:39
also note there is a difference in the permissions required with
postgres's "COPY" command and psql's "\copy" option.

The former requires server level privs (which, if you are in a shared
hosting environment, not likely to have).

see the "notes" section here:
http://www.postgresql.org/docs/8.1/interactive/sql-copy.html
This topic is locked and can not be replied to.