Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support neo4j temporal types #1539

Open
drpump opened this issue Mar 10, 2019 · 5 comments
Open

Support neo4j temporal types #1539

drpump opened this issue Mar 10, 2019 · 5 comments

Comments

@drpump
Copy link

drpump commented Mar 10, 2019

Neo4j 3.4 introduced temporal types, including datetime and local_datetime. The neo4j gem does not yet support these: it converts Ruby Date, Time, DateTime types into an integer, and duration types are not utilised. Please add support for these temporal types.

@drpump
Copy link
Author

drpump commented Mar 10, 2019

I should be able to spare some time to work on this, but don't know enough about the neo4j API or the ruby gems to drive it.

@klobuczek
Copy link
Member

All those types will be supported in neo4j-ruby-driver. They already are in the jruby version. There is work remaining to make the neo4j gem fully leverage the driver. That will probably happen along with discontinuing support for any adaptor except the the (bolt) driver.

@hahashraf
Copy link

hahashraf commented Oct 21, 2019

Not sure if this helps or hurts, and I know this issue is old and is currently being worked on (via neo4j-ruby-driver w/ seabolt), but figured I'd chime in.

I wanted to use neo4j and neo4j-core (thanks so much for all the work!) but I really wanted to utilize the temporal types introduced in Neo4j 3.4, so I spent some time digging into the official java driver and got the current Bolt adaptor working with Date/DateTime/Time ruby classes.

neo4j-core: https://github.com/ashie1287/neo4j-core/commit/3c6332ecd4d52c99d72774c362611c8cabaf8f3c

neo4j: https://github.com/ashie1287/neo4j/commit/97a5cf1426c374f67492b4a249b8d2ad5acd239d

Unfortunately, there's no documentation for Bolt v2, v3, or v4, so that's why I went off the java driver implementation. I also discovered this developer site, but it's still lacking. https://neo4j-drivers.github.io

The implementation is minimal, pretty hacky, and definitely breaks support for existing projects (that use Integer for temporal types, or use Neo4j < 3.4), but it does work for my needs (tested with Neo4j 3.5.9 and 3.5.5, which is the version GrapheneDB is currently on). It also jumps from Bolt v1 to Bolt v3 (with neo4j 3.5.5, I couldn't successfully negotiate handshake for v2, sending v2 still put the connection on v1).

As with everyone, my time is limited, but I'm curious to hear if it's worth cleaning up the implementation and submitting a PR. I'd most likely need a lot of direction, and I think it'd be a lot of work, specifically:

  • Supporting all of Bolt v1, v2 and v3
  • Supporting projects using Neo4j < 3.4
  • Supporting projects still using Integer for temporal types

Either way, just wanted to share and try to give back a little. Thanks again for all the work!

@hahashraf
Copy link

Ah, also just seeing #1575 , not sure if that invalidates anything above.

@klobuczek
Copy link
Member

@ashie1287 thanks for that. The temporal types are implemented here: https://github.com/neo4jrb/neo4j-ruby-driver/tree/master/lib/neo4j/driver/types and the conversion here https://github.com/neo4jrb/neo4j-ruby-driver/tree/master/ffi/neo4j/driver/internal/value.

The type mapping might be not ideal https://github.com/neo4jrb/neo4j-ruby-driver/blob/master/docs/dev_manual_examples.rb#L265-L287. I would very much appreciate any feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants