Comments (8)
Thanks for reporting this!
I'll take a look at the issue and your pull request very soon.
from nredisgraph.
@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.
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.
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.
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.
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.
@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.
Yes, I tested it now and it seems to work fine. :)
from nredisgraph.
Related Issues (20)
- Production usage HOT 1
- Escaping query parameters HOT 2
- RedisGraph integer type is 64-bit signed integers
- How to specify the password used to connect? HOT 2
- Add support for GRAPH.RO_QUERY HOT 1
- Add support for GRAPH.CONFIG
- Add support for GRAPH.EXPLAIN
- Add support for GRAPH.LIST
- Add support for GRAPH.PROFILE
- Add support for GRAPH.SLOWLOG
- Add ability to provide command flags...
- Support casting a result value as a map. HOT 1
- Support for Geo points.
- Support for "timeout" argument on `GraphQuery` method. HOT 1
- Obsolete attribute for RedisGraph 2.1 HOT 1
- Library does not lend itself to unit testing HOT 3
- Support map as parameter HOT 2
- Handle backslashes in string parameters
- Need to support nested Records in the Result Set HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nredisgraph.