Heroku db:pull失败,出现SQLite错误?

问题描述:

不知道发生了什么,所以这里的全部跟踪:Heroku db:pull失败,出现SQLite错误?

Receiving schema 
Schema:   0% |           | ETA: --:--:-- 
Schema:   9% |===          | ETA: 00:00:15 
Schema:   18% |=======         | ETA: 00:00:12 
Schema:   27% |===========        | ETA: 00:00:10 
Schema:   36% |===============       | ETA: 00:00:09 
Schema:   45% |==================      | ETA: 00:00:08 
Schema:   54% |======================     | ETA: 00:00:06 
Schema:   63% |==========================    | ETA: 00:00:05 
Schema:   72% |==============================   | ETA: 00:00:04 
Schema:   81% |==================================  | ETA: 00:00:02 
Schema:   90% |=====================================  | ETA: 00:00:01 
Schema:  100% |==========================================| Time: 00:00:15 
Receiving indexes 
schema_migrat: 0% |           | ETA: --:--:-- 
schema_migrat: 100% |==========================================| Time: 00:00:00 
sections:  0% |           | ETA: --:--:-- 
sections:  100% |==========================================| Time: 00:00:00 
tweets:   0% |           | ETA: --:--:-- 
tweets:   33% |=============        | ETA: 00:00:01 
tweets:   66% |===========================    | ETA: 00:00:00 
tweets:  100% |==========================================| Time: 00:00:02 
retweets:  0% |           | ETA: --:--:-- 
retweets:  100% |==========================================| Time: 00:00:00 
Receiving data 
11 tables, 2,200 records 
schema_migrat: 100% |==========================================| Time: 00:00:00 
sections:  100% |==========================================| Time: 00:00:00 
boxes:   100% |==========================================| Time: 00:00:00 
sales_channel: 100% |==========================================| Time: 00:00:00 
users:   100% |==========================================| Time: 00:00:00 
settings:  100% |==========================================| Time: 00:00:00 
admins:  100% |==========================================| Time: 00:00:00 
entries:  100% |==========================================| Time: 00:00:00 
tweets:  100% |==========================================| Time: 00:00:00 
/Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:91:in `initialize': SQLite3::SQLException: near ".": syntax error (Sequel::DatabaseError) 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:91:in `new' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:91:in `prepare' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sqlite3-1.3.3/lib/sqlite3/database.rb:223:in `execute_batch' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/adapters/sqlite.rb:130:in `block (2 levels) in _execute' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/logging.rb:28:in `log_yield' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/adapters/sqlite.rb:130:in `block in _execute' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/connection_pool/threaded.rb:71:in `hold' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:226:in `synchronize' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/adapters/sqlite.rb:117:in `_execute' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/adapters/sqlite.rb:87:in `execute_dui' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:552:in `execute_dui' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `block (2 levels) in import' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `each' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `block in import' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/query.rb:223:in `_transaction' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/query.rb:209:in `block in transaction' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/connection_pool/threaded.rb:84:in `hold' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:226:in `synchronize' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/database/query.rb:207:in `transaction' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/sequel-3.20.0/lib/sequel/dataset/actions.rb:243:in `import' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/data_stream.rb:315:in `import_rows' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/data_stream.rb:142:in `fetch_remote' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:308:in `block in pull_data_from_table' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:301:in `loop' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:301:in `pull_data_from_table' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:284:in `block in pull_data' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:278:in `each' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:278:in `pull_data' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:253:in `block in run' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:203:in `call' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:203:in `catch_errors' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/operation.rb:246:in `run' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/taps-0.3.23/lib/taps/cli.rb:171:in `clientxfer' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/heroku-2.3.6/lib/heroku/command/db.rb:191:in `taps_client' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/heroku-2.3.6/lib/heroku/command/db.rb:59:in `pull' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/heroku-2.3.6/lib/heroku/command.rb:114:in `run' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/gems/heroku-2.3.6/bin/heroku:14:in `<top (required)>' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/bin/heroku:19:in `load' 
    from /Users/justin/.rvm/gems/ruby-1.9.2-p136/bin/heroku:19:in `<main>' 

显然,这看起来对我来说,有一个在tweets表中的问题,但我不知道它可能是什么,因为应用程序的开发工作和在生产中的heroku。

下面是该表的架构:

create_table "tweets", :force => true do |t| 
    t.integer "authorization_id" 
    t.string "name" 
    t.string "screen_name" 
    t.string "uid" 
    t.integer "tid" 
    t.string "tid_string" 
    t.string "text" 
    t.integer "followers_count" 
    t.integer "statuses_count" 
    t.integer "friends_count" 
    t.integer "retweets_count" 
    t.datetime "created_at" 
    t.datetime "updated_at" 
    end 

    add_index "tweets", ["authorization_id"], :name => "index_tweets_on_authorization_id" 
    add_index "tweets", ["tid"], :name => "index_tweets_on_tid" 
    add_index "tweets", ["tid_string"], :name => "index_tweets_on_tid_string" 

锐推:

create_table "retweets", :force => true do |t| 
    t.integer "entry_id" 
    t.string "twitter_username" 
    t.datetime "tweet_date" 
    t.datetime "created_at" 
    t.datetime "updated_at" 
    t.string "twitter_user_id_str" 
    t.string "name" 
    t.integer "twitter_user_id" 
    t.integer "tweet_id" 
    t.string "tweet_id_str" 
    end 

    add_index "retweets", ["entry_id"], :name => "index_retweets_on_entry_id" 
+0

你的模式是什么样的? Sqlite3,PostgreSQL和续集有一些差异。 – ghoppe

+0

这里是第91行,发生该错误https://github.com/luislavena/sqlite3-ruby/blob/v1.3.3/lib/sqlite3/database.rb#L91你的tweets表是什么样的?在那里你不能在别处使用任何东西? –

+0

我已添加模式 – Slick23

因此,我今天早上安装了postgres并尝试了一个db:pull,但它仍然失败 - 但是,postgres更具启发性。这不是retweets表失败,但authorizations。我错误地输入了一列作为last__name一段时间后忘了删除它(我已经添加了last_name)。一旦我将其从数据库中清除出去,db:pull正在处理sqlite和postgres。

我认为这是在PostgreSQL之间的差异是在Heroku和SQLite造成的。我会切换到PostgreSQL。即使你得到它的工作,你以后可能会遇到问题。

我安装了PostgreSQL,这很容易。

+0

这就是龙头宝石的用途。它应该执行与数据库无关的数据提取。 – Slick23

+0

@最终草案唉,并非所有的差异都被解释了。过去我曾经遇到过将数据库迁移到heroku的问题。 – ghoppe

+1

尽管我同意他应该转向使用Postgres,但这只是侧面提到这个问题。我们试着找出问题的根源。 –