Thread: How to copy tables between databases?

How to copy tables between databases?

From
"Kynn Jones"
Date:


Is there a simple way to copy a table from one database to another without generating an intermediate dump file?

TIA!

Kynn

Re: How to copy tables between databases?

From
Tom Hart
Date:
Kynn Jones wrote:
>
>
> Is there a simple way to copy a table from one database to another
> without generating an intermediate dump file?
>
> TIA!
>
> Kynn
>
You're looking for ETL.

http://en.wikipedia.org/wiki/Extract%2C_transform%2C_load

--
Tom Hart
IT Specialist
Cooperative Federal
723 Westcott St.
Syracuse, NY 13210
(315) 471-1116 ext. 202
(315) 476-0567 (fax)


Re: How to copy tables between databases?

From
"Dawid Kuroczko"
Date:
On Tue, Feb 26, 2008 at 9:19 PM, Kynn Jones <kynnjo@gmail.com> wrote:
>
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?

Using UNIX pipes :-)

$ pg_dump ... | psql ...

:-)

   Regards,
       Dawid

Re: How to copy tables between databases?

From
Richard Huxton
Date:
Kynn Jones wrote:
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?

Something along the lines of:
pg_dump ... -d db1 --table=mytable | psql -d db2

--
   Richard Huxton
   Archonet Ltd

Re: How to copy tables between databases?

From
"Uwe C. Schroeder"
Date:
On Tuesday 26 February 2008, Kynn Jones wrote:
> Is there a simple way to copy a table from one database to another without
> generating an intermediate dump file?
> TIA!
>
> Kynn


pg_dump -t [table] [database] | psql -U [remoteuser] -h [remotehost]
[remotedatabase]

comes to mind...

You can and maybe have to add more switches to the pg_dump command, but the
above is what I'm doing (my local db is set to trust) to copy a table with
data to a remote machine

    Uwe

--
Open Source Solutions 4U, LLC    1618 Kelly St
Phone:  +1 707 568 3056        Santa Rosa, CA 95401
Cell:   +1 650 302 2405        United States
Fax:    +1 707 568 6416

Re: How to copy tables between databases?

From
Brad Nicholson
Date:
On Tue, 2008-02-26 at 15:19 -0500, Kynn Jones wrote:
>
> Is there a simple way to copy a table from one database to another
> without generating an intermediate dump file?
>

pg_dump -t <table name> <source DB> | psql -d <target DB>
--
Brad Nicholson  416-673-4106
Database Administrator, Afilias Canada Corp.



Re: How to copy tables between databases?

From
"Scott Marlowe"
Date:
On Tue, Feb 26, 2008 at 2:36 PM, Brad Nicholson
<bnichols@ca.afilias.info> wrote:
> On Tue, 2008-02-26 at 15:19 -0500, Kynn Jones wrote:
>  >
>  > Is there a simple way to copy a table from one database to another
>  > without generating an intermediate dump file?
>  >
>
>  pg_dump -t <table name> <source DB> | psql -d <target DB>

Starting around 8.2 you can have > 1 -t switch, and grab a table or a
wildcarded set of tables with each one.