Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
pgloader未将数据从MySQL导入Postgres_Mysql_Sql_Postgresql_Database Migration_Pgloader - Fatal编程技术网

pgloader未将数据从MySQL导入Postgres

pgloader未将数据从MySQL导入Postgres,mysql,sql,postgresql,database-migration,pgloader,Mysql,Sql,Postgresql,Database Migration,Pgloader,我尝试了以下命令,它没有返回任何错误,但是数据没有导入到我的postgres数据库中 数据库已在Postgres中创建 pgloader mysql://user:password@localhost/mydb postgresql://user:password@localhost/mydb 结果是: table name read imported errors total t

我尝试了以下命令,它没有返回任何错误,但是数据没有导入到我的postgres数据库中

数据库已在Postgres中创建

pgloader mysql://user:password@localhost/mydb postgresql://user:password@localhost/mydb
结果是:

                                        table name       read   imported     errors      total time
-------------------------------------------------  ---------  ---------  ---------  --------------
                                  fetch meta data         38         38          0          1.032s 
                                   Create Schemas          0          0          0          0.253s 
                                 Create SQL Types          0          0          0          0.008s 
                                    Create tables         20         20          0          0.417s 
                                   Set Table OIDs         10         10          0          0.020s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                        mydb.active_admin_comments          0          0          0          0.007s 
                         mydb.ar_internal_metadata          1          1          0          0.139s 
                                  mydb.departments          2          2          0          0.090s 
                                        mydb.roles          2          2          0          0.174s 
                                   mydb.sentiments          3          3          0          0.223s 
                                mydb.twitter_users          6          6          0          0.276s 
                                 mydb.designations          3          3          0          0.087s 
                            mydb.schema_migrations         17         17          0          0.085s 
                                       mydb.tweets         47         47          0          0.238s 
                                        mydb.users          2          2          0          0.184s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                          COPY Threads Completion          4          4          0          0.333s 
                                   Create Indexes         22         22          0          2.770s 
                           Index Build Completion         22         22          0          0.626s 
                                  Reset Sequences          8          8          0          0.208s 
                                     Primary Keys         10         10          0          0.069s 
                              Create Foreign Keys          6          6          0          0.053s 
                                  Create Triggers          0          0          0          0.000s 
                                 Install Comments          0          0          0          0.000s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                                Total import time         83         83          0          4.051s 
user1=> \c mydb postgres
Password for user postgres: 
psql (10.0, server 9.6.5)
You are now connected to database "mydb" as user "postgres".
mydb=# SELECT count(*) FROM users;

 count 
-------
     0
(1 row)

mydb=# \dn
            List of schemas
            Name             |  Owner   
-----------------------------+----------
 public                      | postgres
 mydb                        | postgres
(2 rows)
当我登录到psql查找数据时,它不在那里。例如,对于表用户,pgloader应如上所述导入2条记录,但结果如下:

                                        table name       read   imported     errors      total time
-------------------------------------------------  ---------  ---------  ---------  --------------
                                  fetch meta data         38         38          0          1.032s 
                                   Create Schemas          0          0          0          0.253s 
                                 Create SQL Types          0          0          0          0.008s 
                                    Create tables         20         20          0          0.417s 
                                   Set Table OIDs         10         10          0          0.020s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                        mydb.active_admin_comments          0          0          0          0.007s 
                         mydb.ar_internal_metadata          1          1          0          0.139s 
                                  mydb.departments          2          2          0          0.090s 
                                        mydb.roles          2          2          0          0.174s 
                                   mydb.sentiments          3          3          0          0.223s 
                                mydb.twitter_users          6          6          0          0.276s 
                                 mydb.designations          3          3          0          0.087s 
                            mydb.schema_migrations         17         17          0          0.085s 
                                       mydb.tweets         47         47          0          0.238s 
                                        mydb.users          2          2          0          0.184s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                          COPY Threads Completion          4          4          0          0.333s 
                                   Create Indexes         22         22          0          2.770s 
                           Index Build Completion         22         22          0          0.626s 
                                  Reset Sequences          8          8          0          0.208s 
                                     Primary Keys         10         10          0          0.069s 
                              Create Foreign Keys          6          6          0          0.053s 
                                  Create Triggers          0          0          0          0.000s 
                                 Install Comments          0          0          0          0.000s 
-------------------------------------------------  ---------  ---------  ---------  --------------
                                Total import time         83         83          0          4.051s 
user1=> \c mydb postgres
Password for user postgres: 
psql (10.0, server 9.6.5)
You are now connected to database "mydb" as user "postgres".
mydb=# SELECT count(*) FROM users;

 count 
-------
     0
(1 row)

mydb=# \dn
            List of schemas
            Name             |  Owner   
-----------------------------+----------
 public                      | postgres
 mydb                        | postgres
(2 rows)

出了什么问题?

我假设由于术语的不同(mysql模式是postgres作为数据库使用的模式),您的表已加载到mydb模式,而不是public。表名中带有“前缀”的列表给出了这个想法。因此,为了找到加载的数据,请在表名之前指定模式名,例如

select count(*) from mydb.schema_migrations

应该返回17行-使用
pgloader

导入,我假设由于术语的不同(mysql模式是postgres作为数据库使用的),您将表加载到mydb模式,而不是公共模式。表名中带有“前缀”的列表给出了这个想法。因此,为了找到加载的数据,请在表名之前指定模式名,例如

select count(*) from mydb.schema_migrations

应返回17行-使用
pgloader导入

导入后,还可以使用加载文件将表公开

将其添加到文件(例如load_file.load):

并运行:

$ pgloader load_file.load

导入后,还可以使用加载文件将表公开

将其添加到文件(例如load_file.load):

并运行:

$ pgloader load_file.load

为什么您认为它没有导入?@VaoTsun,因为我的postgres db似乎是空的。它没有记录。请用你如何检查它的输出更新帖子?@VaoTsun我已经更新了问题。使用psql检查数据。以防万一列表架构“\dn”?…为什么您认为它未导入?。@VaoTsun,因为我的postgres db似乎为空。它没有记录。请用你如何检查它的输出更新帖子?@VaoTsun我已经更新了问题。正在使用psql检查数据。以防万一列表架构“\dn”?。。