Are you using Elixir for connecting to Neo4j graph databases? Then we would love your feedback!

Hi there,

We’re working on the docs and adding final touches to the Neo4j driver for Elixir: Bolt.Sips, and we need your feedback. The development of the latest version was moved to the public area (on GitHub), for offering you an early preview of what’s coming.

The documentation for the new features, functions and modules, including the new docs/ sections, etc. is work in progress pretty much, however, the code is stable and it can be used for experimenting with the new features introduced by this version:

  • routing
  • role based connections
  • multi-tenancy
  • better support for errors
  • and so much more

If anyone here using Elixir, for connecting to Neo4j, and wanting to test this new version, then we’d love to have your feedback. You can use this new driver for connecting to a single Neo4j server, to a Neo4j causal cluster or to … multiple servers … or to … multiple clusters, concurrently! w⦿‿⦿t! :slight_smile:

If you’re interested, please join our project at github.com/florinpatrascu/bolt_sips, and we’ll be happy to work with you through examples, while augmenting our docs and code, based on your feedback and suggestions. Any feedback is: good feedback :slight_smile:

Thank you!
:heart:

7 Likes

Yes I am interested.

I have this project

This extract data (well all of) the contentful space into a neo4j graph database.

1 Like

That’s awesome! Please check the new version if you have time, and share with us your experience. Plus if you spot any bugs or place for improvements then don’t hesitate to contribute with opening issues or PRs. Many thanks!!

I also have:

This loads the dependencies from package.json in a node project into a neo4j graph database.
I took an unusual approach with starting bolt - it starts a runtime so that you can specify the destination neo4j database from the cli.

1 Like

Here are my notes on converting package_compare to use the new version.

The github repo says to use v2 but its not yet in hex.pm.
For now you need to use:

{:bolt_sips, git: “https://github.com/florinpatrascu/bolt_sips”}

poison is now on version 4 and you are using version 3 so I have had to downgrade.

This is the code that I am trying to translate:

def start(database, username, password) do
    Bolt.Sips.start_link(%{url: database, username: username, password: password})
  end

  def write_to_neo4j(data) do
    conn = Bolt.Sips.begin(Bolt.Sips.conn)
    
    #Nodes need to be reversed as prefixed by delete statements
    entry_data = Enum.reverse(data.nodes)
    Enum.each(entry_data, fn(item) -> 
       Bolt.Sips.query(conn, item.query, item.params)  
    end )

    #Relationships include the properties
    Enum.each(data.relationships, fn(item) -> 
       Bolt.Sips.query(conn, item.query, item.params)  
    end )

    Bolt.Sips.commit(conn)
  end   

I am kind of stuck.

1 Like

Thank you for the feedback so far. I didn’t publish the driver yet, since there are functions where I still need to update the docs, but there are only so many hours in a day :slight_smile: I’ll make sure I’ll add a note about that in the main README, ty!

Regarding the way you’re using the transactions; I believe you’re using a very old version of the driver, because the support for non-closure based transactions was dropped since a couple of releases ago. In fact I mentioned this in the CHANGELOG, when that happened: https://github.com/florinpatrascu/bolt_sips/blame/master/CHANGELOG.md#L94

We are using the awesome DBConnection under the hood, but we had to drop this transaction style when it wasn’t supported by the DBConnection either. There are clarifying discussions on this topic, in the issues tracker of DBConnection.

However, you can easily convert your code to using the new transaction style, An example from the actual tests we’re using:

  test "execute statements in transaction", %{main_conn: main_conn} do
    Bolt.Sips.transaction(main_conn, fn conn ->
      book =
        Bolt.Sips.query!(conn, "CREATE (b:Book {title: \"The Game Of Trolls\"}) return b")
        |> Response.first()

      assert %{"b" => g_o_t} = book
      assert g_o_t.properties["title"] == "The Game Of Trolls"
      Bolt.Sips.rollback(conn, :changed_my_mind)
    end)

    books = Bolt.Sips.query!(main_conn, "MATCH (b:Book {title: \"The Game Of Trolls\"}) return b")
    assert Enum.count(books) == 0
  end

Hope this helps?!

Also, I believe for specific issue like these, discussing them in the project’s own issue tracker would be more appropriate, if you don’t mind?! Will be easier for us to track the issues, plus I am sure the kind viewers here will appreciate lesser traffic on topics not as popular as others as graphdbs are a niche … for now :slight_smile:

Thanks again!

Shame on me, I’m discovering this topic only now…
Will keep on eye on it now!

1 Like

Hi,

I’m using this driver and really like it.

I have however run into a tedious issue. Queries that take >1ms when running in the browser takes roughly linearly 50ms for each returned row when running from my project (fetching from localhost).

I would guess it is not an actual performance issue but rather something I have misconfigured but I cannot understand what.

Which channel would be best suitable for this (probably) non-issue question?

Thank you for feedback. @otuv - you can open an issue here: https://github.com/florinpatrascu/bolt_sips/issues, and we’ll continue the discussion from there. However, can you please check you’re using the newest version? I published v2.0.3 yesterday, and it contains a significant amount of changes, some specifically dedicated to improving the performance. Also when you’re using the browser to see your data on the server, you’re connected directly to the Neo4j server, and that type of connection is expected to sport the response time you see :slight_smile: When you’re using our driver, we do a bit of additional work before shipping the data out, so we might usually lag a bit behind the 1ms you’re reporting

:wink:

Please see: https://github.com/florinpatrascu/bolt_sips/issues/73, for brevity.

That seems to be a very similar problem. Will definitely try 2.0.x!

Ok,

There is no need for an issue. Switching to 2.0.x did it all.

My numbers on three (small) test queries went from
average (max/min)

426  (479/330)  ->  29  (80/3)
16   (18/15)    ->  2   (2/2)
54   (56/53)    ->  3   (6/2)

Thank you for fixing my problem even before I mentioned it :wink:

2 Likes

W⦿‿⦿t!

Awesome! I’m glad it helped and thank you for trying our driver :heart:

1 Like