Coder Social home page Coder Social logo

Comments (8)

tombatron avatar tombatron commented on June 23, 2024

Thanks for reporting this!

I'll take a look at the issue and your pull request very soon.

from nredisgraph.

tombatron avatar tombatron commented on June 23, 2024

@Ivan-Gyoshev It just occurred to me 🤦‍♂️, would you mind trying the method GraphReadOnlyQuery (or GraphReadOnlyQueryAsync)?

The implementation is VERY similar to the pull request that you opened.

from nredisgraph.

Ivan-Gyoshev avatar Ivan-Gyoshev commented on June 23, 2024

Hey @tombatron ,

Do you mean using the already implemented method GraphReadOnlyQuery instead of creating the new one(ReadOnlyQuery) which I put in the pull request?

from nredisgraph.

tombatron avatar tombatron commented on June 23, 2024

Yes.

Also, could I get some sample data and a sample procedure to replicate for a test.

I'd also like to check Jedis's RedisGraph support for the same issue since my goal here is to essentially replicate the "official" support.

from nredisgraph.

tombatron avatar tombatron commented on June 23, 2024

Yes.

Also, could I get some sample data and a sample procedure to replicate for a test.

I'd also like to check Jedis's RedisGraph support for the same issue since my goal here is to essentially replicate the "official" support.

from nredisgraph.

Ivan-Gyoshev avatar Ivan-Gyoshev commented on June 23, 2024

Hello,
I updated my pull request.

Here is a little sample of how you can reproduce this issue:

Connect to your master Redis graph

ConnectionMultiplexer connectionMultiplexer = ConnectionMultiplexer.Connect("localhost:6379,abortConnect=false");
var db = connectionMultiplexer.GetDatabase();
var redisGraph = new RedisGraph(db);

    // Insert data
    string firstPersonQuery = "CREATE (:Person {username: 'John', age: 20})";
    string secondPersonQuery = "CREATE (:Person {username: 'Peter', age: 23})";
    string thirdPersonQuery = "CREATE (:Person {username: 'Steven', age: 30})";

    redisGraph.GraphQuery("demo", firstPersonQuery);
    redisGraph.GraphQuery("demo", secondPersonQuery);
    redisGraph.GraphQuery("demo", thirdPersonQuery);`

After you enter some sample data in your graph, you have to connect to your read-only replica and read this data.
Connect to your Redis graph replica

ConnectionMultiplexer replicaConnection = ConnectionMultiplexer.Connect("localhost:6378,abortConnect=false");
       var dbReplica = replicaConnection.GetDatabase();
       var redisGraphReplica = new RedisGraph(dbReplica);
    // Read from the read-only replica
    string readQuery = "MATCH x=(p:Person) RETURN nodes(x) as nodes";

    ResultSet records = redisGraphReplica.GraphReadOnlyQuery("demo", readQuery);

    List<Person> result = new List<Person>();

    foreach (Record record in records) // Here it throws the exception (On the iteration)
    {
        var nodes = record.GetValue<object[]>("nodes");

        foreach (var node in nodes)
        {
            if (node is Node castedNode)
            {
                Person person = GetPersonInfo(castedNode);
                result.Add(new Person(person.Name, person.Age));
            }
        }
    }

`

As I described above, when you execute the read-only query and have a result, in the process of deserializing the nodes in the result, the StackExchange.Redis driver is throwing an exception because the deserialization process internally is making GRAPH.QUERY call instead of GRAPH_RO.QUERY

from nredisgraph.

tombatron avatar tombatron commented on June 23, 2024

@Ivan-Gyoshev Would you mind trying: https://www.nuget.org/packages/NRedisGraph/1.7.0-rc ?

If that works for you I'll finalize my changes and publish version 1.7.0.

from nredisgraph.

Ivan-Gyoshev avatar Ivan-Gyoshev commented on June 23, 2024

Yes, I tested it now and it seems to work fine. :)

from nredisgraph.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.