Closed shu-bc closed 4 years ago
@shu-bc could you provide some complete code snippet or failing spec? I cannot reproduce what you are seeing.
[1] pry(main)> Role.all.class
=> ActiveGraph::Node::Query::QueryProxy
Depending on what method you are invoking on the QueryProxy, it might be materialized via to_a
. The set of methods that cause to_a
call might have changed from 9.x to 10.x, but those are all methods that make sense to trigger query execution.
e.g.
[4] pry(main)> Role.all.each.class
Role
MATCH (n:`Role`)
RETURN n
BOLT: 0ms
=> Enumerator
[5] pry(main)> Role.all.map.class
=> Enumerator
@klobuczek I have a model class like this
# frozen_string_literal: true
class SalesList
include ActiveGraph::Node
include ActiveGraph::Timestamps
property :name, type: String
property :archived, type: Boolean, default: false
property :enabled, type: Boolean, default: true
end
In rails console (in docker), this happens.
I have to cancel the execution by ctrl-c
[1] pry(main)> SalesList.all
=> BOLT: 0ms
BOLT: 0ms
SalesList
MATCH (n:`SalesList`)
RETURN n
BOLT: 0ms
^C^C^C[conn-1]: Protocol violation (received summary code 177)
(pry) output error: Interrupt
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/logger.rb:88:in `add'
/usr/local/lib/ruby/2.6.0/logger.rb:525:in `info'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/internal_logger.rb:27:in `block in func'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/handlers/response_handler.rb:24:in `fetch_summary'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/handlers/response_handler.rb:24:in `ensure in finalize'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/handlers/response_handler.rb:25:in `finalize'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/explicit_transaction.rb:9:in `finalize'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/explicit_transaction.rb:93:in `do_commit'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/explicit_transaction.rb:77:in `commit'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/ffi/neo4j/driver/internal/explicit_transaction.rb:48:in `close'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/transaction.rb:10:in `close'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/lib/neo4j/driver/auto_closable.rb:21:in `block (3 levels) in with_block_definer'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/transactions.rb:43:in `run_transaction_work'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/transactions.rb:38:in `block in send_transaction'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/neo4j-ruby-driver-1.7.0/lib/neo4j/driver/auto_closable.rb:19:in `block (3 levels) in with_block_definer'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/transactions.rb:37:in `send_transaction'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/transactions.rb:21:in `transaction'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/base.rb:33:in `query'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/core/query.rb:238:in `response'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/core/query.rb:297:in `pluck'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy_enumerable.rb:80:in `pluck'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy_enumerable.rb:95:in `pluck_vars'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy_eager_loading.rb:12:in `pluck_vars'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy_enumerable.rb:22:in `result'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy_enumerable.rb:13:in `each'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy.rb:58:in `to_a'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activegraph-10.0.0/lib/active_graph/node/query/query_proxy.rb:58:in `inspect'
/usr/local/lib/ruby/2.6.0/pp.rb:288:in `pretty_print'
/usr/local/lib/ruby/2.6.0/pp.rb:161:in `block in pp'
/usr/local/lib/ruby/2.6.0/prettyprint.rb:253:in `block (2 levels) in group'
/usr/local/lib/ruby/2.6.0/prettyprint.rb:280:in `nest'
/usr/local/lib/ruby/2.6.0/prettyprint.rb:252:in `block in group'
/usr/local/lib/ruby/2.6.0/prettyprint.rb:265:in `group_sub'
/usr/local/lib/ruby/2.6.0/prettyprint.rb:251:in `group'
/usr/local/lib/ruby/2.6.0/pp.rb:161:in `pp'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/color_printer.rb:26:in `pp'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/color_printer.rb:20:in `block in pp'
/usr/local/lib/ruby/2.6.0/pp.rb:120:in `guard_inspect_key'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/color_printer.rb:20:in `pp'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/color_printer.rb:14:in `block in default'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pager.rb:35:in `open'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/color_printer.rb:12:in `default'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:302:in `call'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:302:in `show_result'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:672:in `block in handle_line'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:382:in `critical_section'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:671:in `handle_line'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:261:in `block (2 levels) in eval'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in `catch'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:260:in `block in eval'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in `catch'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_instance.rb:259:in `eval'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:77:in `block in repl'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:67:in `loop'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:67:in `repl'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:38:in `block in start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/input_lock.rb:61:in `__with_ownership'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/input_lock.rb:78:in `with_ownership'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:38:in `start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/repl.rb:15:in `start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-0.13.1/lib/pry/pry_class.rb:191:in `start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/pry-byebug-3.9.0/lib/pry-byebug/pry_ext.rb:13:in `start_with_pry_byebug'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/console/console_command.rb:64:in `start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/console/console_command.rb:19:in `start'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands/console/console_command.rb:96:in `perform'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/command/base.rb:69:in `perform'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/command.rb:46:in `invoke'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/commands.rb:18:in `<main>'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.6/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `block in require'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:257:in `load_dependency'
/usr/local/src/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require'
bin/rails:4:in `<main>'
But returned value is QueryProxy class
[4] pry(main)> SalesList.all.class
=> ActiveGraph::Node::Query::QueryProxy
In addition, if scope and property have the same name( e.g. enabled
), then this happens, which never happened with 9.x
new
triggered query execution, and strangely enabled
turns out to be QueryProxy
[6] pry(main)> SalesList.new
=> BOLT: 0ms
BOLT: 0ms
CYPHER
MATCH (n:`SalesList`)
WHERE
(ID(n) = $ID_n) AND
(n.enabled = $n_enabled)
RETURN n | {:ID_n=>0, :n_enabled=>true}
BOLT: 0ms
#<SalesList uuid: nil, archived: false, created_at: nil, enabled: #<QueryProxy []>, name: nil, updated_at: nil>
@shu-bc so 2 things:
SalesList.all
in pry always executes the query as pry calls inspect
on it. This shouldn't have changed from 9.x.ActiveGraph::UndeclaredProperties
, do not declare the property, and access it like that: sales_list[:enabled]
.@klobuczek Thank you very much! It is now very clear what I have to do next in migration from 9.x to 10.0
I am now trying activegraph v10.0 that is recently released. I found that core mechanic in query has changed. In v 9.x
Project.all
return a QueryProxy, which was convenient to reuse latter. Now, with v 10.0Project.all
just returns all results from neo4j instance, which could often cause a timeout errorI am not sure whether this is intended. If it is, is there any way to avoid it?
Additional information which could be helpful if relevant to your issue:
Code example (inline, gist, or repo)
Runtime information:
Neo4j database version: neo4j 3.40
neo4j
gem version: Activegraph 10.0neo4j-core
gem version: