salesforce_bulk icon indicating copy to clipboard operation
salesforce_bulk copied to clipboard

Errors when parsing returned results

Open terryroe opened this issue 12 years ago • 6 comments

I am trying to use the salesforce_bulk gem to query our Salesforce instance. I can log in successfully, but when I query I get the following results, or similar:

res = salesforce.query("Account", "SELECT id, name FROM Account LIMIT 1")
CSV::IllegalFormatError: CSV::IllegalFormatError
    from /Users/terry/.rbenv/versions/1.8.7-p358/lib/ruby/1.8/csv.rb:607:in `get_row'
    from /Users/terry/.rbenv/versions/1.8.7-p358/lib/ruby/1.8/csv.rb:556:in `each'
    from /Users/terry/.rbenv/versions/1.8.7-p358/lib/ruby/1.8/csv.rb:127:in `collect'
    from /Users/terry/.rbenv/versions/1.8.7-p358/lib/ruby/1.8/csv.rb:127:in `parse'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:132:in `parse_results'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:123:in `get_batch_result'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk.rb:60:in `do_operation'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk.rb:35:in `query'
    from (irb):2

Or this:

res = salesforce.query("Account", "SELECT id FROM Account LIMIT 1")
TypeError: can't convert String into Integer
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:141:in `[]'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:141:in `parse_results'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `each_with_index'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:134:in `each'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:134:in `each_with_index'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:134:in `parse_results'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk/job.rb:123:in `get_batch_result'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk.rb:60:in `do_operation'
    from /Users/terry/.rbenv/versions/1.8.7-p358/gemsets/pcwi-sf-services/gems/salesforce_bulk-1.0.0/lib/salesforce_bulk.rb:35:in `query'
    from (irb):3

Any help on resolving these would be greatly appreciated.

Thanks,

TR

terryroe avatar Sep 08 '12 14:09 terryroe

were you able to resolve this issue?

imranansari avatar Jun 28 '13 16:06 imranansari

Imran,

I ended up not using this gem. I never did find an answer.

TR

On Fri, Jun 28, 2013 at 12:35 PM, Imran Ansari [email protected]:

were you able to resolve this issue?

— Reply to this email directly or view it on GitHubhttps://github.com/jorgevaldivia/salesforce_bulk/issues/11#issuecomment-20199270 .

terryroe avatar Jun 28 '13 16:06 terryroe

I ended up at https://github.com/javierjulio/salesforce_bulk, are you using that?, i'm unable to find a Query example

thanks!

imranansari avatar Jun 28 '13 16:06 imranansari

Imran,

I ended up using the Salesforce REST api.

TR

On Fri, Jun 28, 2013 at 12:49 PM, Imran Ansari [email protected]:

I ended up at https://github.com/javierjulio/salesforce_bulk, are you using that?, i'm unable to find a Query example

thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/jorgevaldivia/salesforce_bulk/issues/11#issuecomment-20200076 .

terryroe avatar Jun 28 '13 17:06 terryroe

I'm having this issue now too... I have not resolved it

mzrzvi avatar Mar 31 '15 15:03 mzrzvi

I figured it out! I was using Ruby 1.8.7 which seems to be unsupported. Ran the exact same code in 1.9.3 and it works just as expected!

mzrzvi avatar Mar 31 '15 20:03 mzrzvi