开发者

Heroku db:pull fails with SQLite error?

Not sure what's happening, so here's the full trace:

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:22开发者_如何学Go6: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>'

Obviously, it looks to me like there's a problem in the tweets table, but I have no idea what it could be since the app works in development and on heroku in production.

Here's the schema for that table:

 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"

Retweets:

  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"


I think it is caused by a difference between PostgreSQL which is on Heroku and SQLite. I would switch to PostgreSQL. Even if you get it working, you will probably have issues later.

I installed PostgreSQL and it was pretty easy.


So I installed postgres this morning and tried a db:pull and it still failed -- but, postgres was a little more instructive. It wasn't the retweets table that was failing, but authorizations. I'd mistakenly typed a column as last__name a while back and forgot to remove it (I'd already added last_name). Once I cleared that out of the database, the db:pull is working on sqlite and postgres again.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜