Skip to content

Exception: redisgraph.query_result.QueryResult.pretty_print #41

Closed
@andreaBelmont

Description

@andreaBelmont

Running this code:

import redis
import redisgraph
print(redis.__version__)
from redisgraph import Node, Edge, Graph
r = redis.Redis(host='localhost', port=6379)
redis_graph = Graph('social', r)
john = Node(label='person', properties={'name': 'John Doe', 'age': 33, 'gender': 'male', 'status': 'single'})
redis_graph.add_node(john)
japan = Node(label='country', properties={'name': 'Japan'})
redis_graph.add_node(japan)
redis_graph.commit()
query = """MATCH (p:person)-[v:visited {purpose:"pleasure"}]->(c:country)
		   RETURN p.name, p.age, v.purpose, c.name"""

result = redis_graph.query(query)

# Print resultset
result.pretty_print()

raises:

3.2.1
Traceback (most recent call last):
  File "./test.py", line 18, in <module>
    result.pretty_print()
  File "/Users/acortis/my_codes/testbed/PySyft/.env/lib/python3.7/site-packages/redisgraph/query_result.py", line 33, in pretty_print
    tbl.add_row(['No data returned.'])
  File "/Users/acortis/my_codes/testbed/PySyft/.env/lib/python3.7/site-packages/prettytable/prettytable.py", line 928, in add_row
    "Row has incorrect number of values, (actual) %d!=%d (expected)" % (len(row), len(self._field_names)))
Exception: Row has incorrect number of values, (actual) 1!=4 (expected)

I am running redisgraph from docker

docker run -p 6379:6379 -it --rm redislabs/redisgraph
1:C 10 Jun 2019 13:56:15.180 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1:C 10 Jun 2019 13:56:15.180 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1, just started
1:C 10 Jun 2019 13:56:15.180 # Configuration loaded
                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 5.0.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 1
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

1:M 10 Jun 2019 13:56:15.181 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
1:M 10 Jun 2019 13:56:15.181 # Server initialized
1:M 10 Jun 2019 13:56:15.181 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
1:M 10 Jun 2019 13:56:15.182 * <graph> Thread pool created, using 6 threads.
1:M 10 Jun 2019 13:56:15.182 * Module 'graph' loaded from /usr/lib/redis/modules/redisgraph.so
1:M 10 Jun 2019 13:56:15.182 * Ready to accept connections

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions