A table data (swdata) not found

15 views
Skip to first unread message

Milar

unread,
Sep 10, 2014, 4:05:19 AM9/10/14
to openaust...@googlegroups.com

I have a script (one file) in Ruby which uses scraperwiki gem. In the directory of this script there's a file titled scraperwiki.sqlite.

items.each do |x|
   if ScraperWiki.select("* from data where .... { x['key123']}'").empty? 
     ScraperWiki.save_sqlite(['key123'], x)
   else
    puts "Skipping already saved record " + record['key123']
   end
end

But nonetheless when I run it I get an error:


/Users/alex/.rvm/gems/ruby-2.1.2/gems/sqlite_magic-0.0.3/lib/sqlite_magic.rb:49:in `rescue in execute': no such table: data (SqliteMagic::NoSuchTable)
  from /Users/alex/.rvm/gems/ruby-2.1.2/gems/sqlite_magic-0.0.3/lib/sqlite_magic.rb:42:in `execute'
  from /Users/alex/.rvm/gems/ruby-2.1.2/gems/scraperwiki-3.0.2/lib/scraperwiki.rb:186:in `select'

Henare Degan

unread,
Sep 10, 2014, 5:25:40 AM9/10/14
to openaustralia-dev
It needs to make a table on the first run. An easy workaround is to rescue the select call, e.g.
if (ScraperWiki.select("* from data where .... { x['key123']}'").empty? rescue true)
Cheers,

Henare
--
Henare Degan
Volunteer & Director - OpenAustralia Foundation

e » hen...@oaf.org.au
w » www.openaustraliafoundation.org.au
t » @OpenAustralia

--
You received this message because you are subscribed to the Google Groups "OpenAustralia Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openaustralia-...@googlegroups.com.
To post to this group, send email to openaust...@googlegroups.com.
Visit this group at http://groups.google.com/group/openaustralia-dev.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages