klobuczek / active_node Goto Github PK
View Code? Open in Web Editor NEWActiveRecord style Object Graph Mapping for neo4j
License: MIT License
ActiveRecord style Object Graph Mapping for neo4j
License: MIT License
Would anyone be interested in connection pooling? If I'm understanding the Neo class correctly, each time Neo.db is called it creates a new connection. I've got connection pooling working in my branch, should I send a pull request?
https://github.com/chrisgogreen/active_node
I added some readme to my branch for using the connection pool.
I wrapped @db
in an if else to check for a globally defined db connection.
module ActiveNode
class Neo
def self.db
if defined? $db
@db = $db
else
@db ||= Neography::Rest.new
end
end
end
end
If you define $db
when your application initializes you can use a configurable connection pool:
require 'connection_pool'
$db = ConnectionPool::Wrapper.new(size: 50, timeout: 15) { Neography::Rest.new }
I'm not sure if using a global is a good idea in this case, but it got me loading data much faster last night. Before I made this change my sidekiq workers were loading about 20 nodes per second(one node per job), right now they are loading about 100.
Maybe instead of checking if a global named $db is defined I could check if any instances of the ConnectionPool class exist?
Is this ready to go? Any hello world examples?
I'd like to be able to create_or_update? I see some code for it but I can't tell how to use it and I don't see it in the specs. Is anyone creating_or_update 'ing?
Here for example, label is not existing on neo4j 1.9.* and so we are hiting exception cause the endpoint label is not existing.
node = User.create! name: 'name'
is hiting :
Neography::NeographyError: Neography::NeographyError
from /Users/kwent/.rvm/gems/ruby-2.1.2@down-node/gems/neography- 1.5.0/lib/neography/connection.rb:244:in `raise_errors'
from /Users/kwent/.rvm/gems/ruby-2.1.2@down-node/gems/neography- 1.5.0/lib/neography/connection.rb:217:in `handle_4xx_500_response'
com.sun.jersey.api.NotFoundException: null for uri: http://localhost:7474/db/data/node/1/labels
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1470)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1400)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
When you try to fetch nodes using association macros (i.e :has_many) it returns simple Array class instead of ActiveNode::Graph.
This way methods cannot be chained further (i.e :order, :includes etc).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.