pgloader icon indicating copy to clipboard operation
pgloader copied to clipboard

Migrating data of a postgre table to another postgre table

Open NilakshaPerera opened this issue 4 years ago • 0 comments

  • [x] pgloader --version

    3.6.2
    
  • [x] did you test a fresh compile from the source tree?

Yes

  • [x] did you search for other similar issues?

Yes

load datatable from pgsql://dbuser:dbpass1@localhost:5432/sourcedb -- source table -- customer_data -- having fields -- ( -- id, instanceid, lmsurl, license, guid -- ) into pgsql://dbuser:dbpass1@localhost:5432/destdb -- target table -- customers -- target columns -- ( -- id, instanceid, lmsurl, license, guid -- ) including only table names matching ~/customer_data/ in schema 'public' ;


  - [ ] pgloader output you obtain
  

2021-10-26T11:17:06.008000Z LOG pgloader version "3.6.2" 2021-10-26T11:17:06.067000Z LOG Migrating from #<PGSQL-CONNECTION pgsql://dbuser@localhost:5432/sourcedb {1005FFA243}> 2021-10-26T11:17:06.067000Z LOG Migrating into #<PGSQL-CONNECTION pgsql://dbuser@localhost:5432/destdb {1005FFC4F3}> 2021-10-26T11:17:06.246000Z LOG report summary reset table name errors rows bytes total time


         fetch meta data          0          2                     0.065s
          Create Schemas          0          0                     0.001s
        Create SQL Types          0          0                     0.004s
           Create tables          0          2                     0.021s
          Set Table OIDs          0          1                     0.000s

"public"."customer_data" 0 5 0.4 kB 0.011s


 COPY Threads Completion          0          4                     0.012s
  Index Build Completion          0          1                     0.009s
          Create Indexes          0          1                     0.006s
         Reset Sequences          0          0                     0.009s
            Primary Keys          0          1                     0.001s
     Create Foreign Keys          0          0                     0.000s
         Create Triggers          0          0                     0.000s
        Install Comments          0          0                     0.000s

       Total import time          ✓          5     0.4 kB          0.037s

PS D:\xampp\htdocs\postgre-docker>


  - [ ] How the data is different from what you expected, if relevant

I am trying to load data from 'customer_data' table into set of the defined fields of the destination table named 'customers'. What I get is a new table named customer_data with the data being created in the destination database. how can I target a particular table to be migrated into another table in the destination table. My source data is coming from a postgre database and the destination im trying to migrate data is also a postgre database. Is this possible using pgloader?

NilakshaPerera avatar Oct 26 '21 11:10 NilakshaPerera