Analytics query with scope doesn't work
Description
Environment
Release Notes Description
blocks
duplicates
Activity
Hakim Cassimally April 13, 2021 at 10:42 AM
Thanks @Sergey Auseyau I've confirmed that fixes the issue!
NB: in the sample test, it did cause the following section to time out. I assume it's something in my setup, and is unrelated to my issue, so I'm not pursuing, but mentioning to you in case it looks at all suspicious to you
puts "scanconsistency"
# tag::scanconsistency[]
options = Cluster::AnalyticsOptions.new
options.scan_consistency = :request_plus
result = cluster.analytics_query(
'SELECT * FROM airports WHERE country = "France" LIMIT 10',
options)
# end::scanconsistency[]
Sergey Auseyau April 12, 2021 at 2:59 PM
@Hakim Cassimally, thanks for noticing it. It looks like the server side has changed decoding. I've adjusted the client.
Hakim Cassimally April 8, 2021 at 1:08 PM
Hi Sergey - sorry, the initial report would indeed be fixed by the https://couchbasecloud.atlassian.net/browse/RCBC-314#icft=RCBC-314 fix...
But the sample code still does not work, see my https://github.com/couchbase/docs-sdk-ruby/pull/20 for https://couchbasecloud.atlassian.net/browse/DOC-7628#icft=DOC-7628 and the first comment above where I get error "Cannot find dataverse with name `travel-sample.inventory`"
(e.g. I think the dataverse name is badly constructed, compared to how other SDKs such as Java do it, and from how I've understood the RFC).
This is having installed latest HEAD, with following version output:
{:sdk=>"3.1.1.snapshot", :backend=>"1.4.1", :build_timestamp=>"2021-04-08 11:04:05", :revision=>"56ca50445a57fe4e1555b54f5f8d9de6c6e9dcf1", :platform=>"Darwin-19.6.0", :cpu=>"x86_64", :cc=>"AppleClang 12.0.0.12000032", :cxx=>"AppleClang 12.0.0.12000032", :ruby=>"3.0.0", :spdlog=>"1.8.1", :asio=>"1.18.0", :snappy=>"1.1.8", :http_parser=>"2.9.4", :openssl_headers=>"OpenSSL 1.1.1i 8 Dec 2020", :openssl_runtime=>"OpenSSL 1.1.1i 8 Dec 2020"}
Can you have another look?
Sergey Auseyau March 22, 2021 at 3:51 PM
Hakim Cassimally March 9, 2021 at 12:44 PM
Hi @Sergey Auseyau I've clarified my understanding of the Analytics and I think my sample code was wrong, but there's still a minor bug in how the Dataverse name is constructed by the SDK:
See e.g. https://github.com/osfameron/docs-sdk-ruby/commit/c7052596db63cc910192dd872f3d358a73c8b5f9
This call ends with the error "Cannot find dataverse with name `travel-sample.inventory`"
However, as https://blog.couchbase.com/collections-simplify-your-analysis-with-couchbase-analytics/ shows, the dataverse name is created as "`travel-sample`.inventory" (e.g. backtick quoted because the bucket name has a - in it).
Details
Details
Assignee
Reporter
Fix versions
Story Points
Priority
Instabug
Sentry
Linked Issues
Sentry
Zendesk Support
Linked Tickets
Zendesk Support

While documenting https://couchbasecloud.atlassian.net/browse/DOC-7628#icft=DOC-7628 https://github.com/couchbase/docs-sdk-ruby/pull/20 it looks like the Analytics query under Scope fails with an error like:
.../.rvm/gems/ruby-3.0.0/gems/couchbase-3.0.3/lib/couchbase/scope.rb:102:in `analytics_query': uninitialized constant Couchbase::Scope::AnalyticsResult (NameError) from modules/howtos/examples/analytics.rb:91:in `<main>'
This is with the following dataverses created;
CREATE DATAVERSE `travel-sample.inventory`; USE `travel-sample.inventory`; CREATE DATASET `airports-collection` ON `travel-sample`.inventory.airport;
That seems to match the RFC, and looks like it's what's implemented in the Java SDK, so raising as bug - although it could be my misunderstanding of how the feature should work?
(In either case, the relevant documentation section is commented out for now).