使用pgloader将sqlite数据库迁移到postgresql

时间:2016-01-25 07:12:25

标签: postgresql sqlite pgloader

我正在尝试使用pgloader将数据库从sqlite迁移到postgresql。我的sqlite数据库叫做app.db.所以运行以下命令

createdb new_pg_appdb
pgloader ./app.db postgresql:///new_pg_appdb

pgloader命令似乎从sqlite数据库导入了一些行,因为最终输出看起来像这样

                table name       read   imported     errors            time
------------------------------  ---------  ---------  ---------  --------------
                     fetch          0          0          0          0.000s
           fetch meta data         20         20          0          0.017s
          create, truncate          0          0          0          0.047s
------------------------------  ---------  ---------  ---------  --------------
           alembic_version          0          1          0          0.136s
               email_stack          0          0          0          0.004s
                    papers          0      56835          0         12.527s
                      user          0          0          0          0.169s
                 followers          0        121          0          0.020s
                    groups          0         29          0          0.004s
             profile_views          0        448          0          0.007s
                read_dates          0       2193          0          0.027s
              reading_list          0       1368          0          0.028s
      special_announcement          0        764          0          0.027s
                   members          0        174          0          0.057s
                 vote_list          0        939          0          0.026s
               paperclicks          0       2459          0          0.052s
              paper_counts          0       2301          0          0.086s
                site_usage          0         27          0          0.005s
          extra_paper_data          0          0          0          0.003s
           journal_details          0        524          0          0.014s
          library_category          0        517          0          0.009s
    library_category_items          0       1447          0          0.019s
    index build completion          0          0          0          0.000s
------------------------------  ---------  ---------  ---------  --------------
            Create Indexes          2          0          2          0.000s
           Reset Sequences          0          0          0          0.019s
------------------------------  ---------  ---------  ---------  --------------
      Total streaming time          0      70147          0         13.303s    

但在此之前,我收到许多错误消息,如

2016-01-24T23:00:02.021000-08:00 LOG Main logs in     '/private/tmp/pgloader/pgloader.log'
2016-01-24T23:00:02.025000-08:00 LOG Data errors in '/private/tmp/pgloader/'
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "alembic_version" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "email_stack" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "papers" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "user" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "followers" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "groups" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "profile_views" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "read_dates" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "reading_list" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "special_announcement" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "members" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "vote_list" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "paperclicks" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "paper_counts" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "site_usage" does     not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "extra_paper_data" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "journal_details" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table "library_category" does not exist, skipping
2016-01-24T23:00:04.235000-08:00 WARNING Postgres warning: table        "library_category_items" does not exist, skipping
2016-01-24T23:00:04.236000-08:00 ERROR The value NIL
is not of type
  (OR INTEGER (SIMPLE-ARRAY CHARACTER (*)) (SIMPLE-ARRAY NIL (*))
      SIMPLE-BASE-STRING).
2016-01-24T23:00:04.236000-08:00 ERROR The value NIL
is not of type
  (OR INTEGER (SIMPLE-ARRAY CHARACTER (*)) (SIMPLE-ARRAY NIL (*))
      SIMPLE-BASE-STRING).
2016-01-24T23:00:04.236000-08:00 ERROR The value NIL
is not of type
  (OR INTEGER (SIMPLE-ARRAY CHARACTER (*)) (SIMPLE-ARRAY NIL (*))
      SIMPLE-BASE-STRING).
2016-01-24T23:00:04.437000-08:00 ERROR The value NIL
is not of type
  (OR INTEGER (SIMPLE-ARRAY CHARACTER (*)) (SIMPLE-ARRAY NIL (*))
      SIMPLE-BASE-STRING).

ERROR:  syntax error at or near "user" at character 34
STATEMENT:  CREATE INDEX ix_user_username ON user (username)
ERROR:  syntax error at or near "user" at character 38
STATEMENT:  CREATE UNIQUE INDEX ix_user_email ON user (email)

知道我在这里做错了什么吗? 谢谢 卡尔

0 个答案:

没有答案