Improve printing format
shravandoda opened this issue · 4 comments
The current printing format in client uses show_data
method in querying_mechanism
module. It prints the data fetched from redis in an inline manner. Instead of the current printing format we can use the inbuilt printing method in the redis-py
module which prints the data in a tabular form.
+-------------+----------+--------------+-----------+ | b'p.name' | b'p.age' | b'v.purpose' | b'c.name' | +-------------+----------+--------------+-----------+` | b'John Doe' | 33 | b'pleasure' | b'Japan' | +-------------+----------+--------------+-----------+
>>>show endpoints classEndpoints + CollectionEndpoints Class Endpoints +-----------------+-------------+------------------------------+---------------------------+ | b'p.properties' | b'p.type' | b'p.id' | b'p.operations' | +-----------------+-------------+------------------------------+---------------------------+ | b"['Location']" | b'Location' | b'vocab:EntryPoint/Location' | b"['POST', 'PUT', 'GET']" | +-----------------+-------------+------------------------------+---------------------------+ b'Query internal execution time: 0.231691 milliseconds' Collection Endpoints +----------------------------+---------------------------------------------+-------------------+ | b'p.type' | b'p.id' | b'p.operations' | +----------------------------+---------------------------------------------+-------------------+ | b'DroneCollection' | b'vocab:EntryPoint/DroneCollection' | b"['GET', 'PUT']" | | b'DatastreamCollection' | b'vocab:EntryPoint/DatastreamCollection' | b"['GET', 'PUT']" | | b'CommandCollection' | b'vocab:EntryPoint/CommandCollection' | b"['GET', 'PUT']" | | b'AnomalyCollection' | b'vocab:EntryPoint/AnomalyCollection' | b"['GET', 'PUT']" | | b'HttpApiLogCollection' | b'vocab:EntryPoint/HttpApiLogCollection' | b"['GET', 'PUT']" | | b'MessageCollection' | b'vocab:EntryPoint/MessageCollection' | b"['GET', 'PUT']" | | b'DroneLogCollection' | b'vocab:EntryPoint/DroneLogCollection' | b"['GET', 'PUT']" | | b'ControllerLogCollection' | b'vocab:EntryPoint/ControllerLogCollection' | b"['GET', 'PUT']" | +----------------------------+---------------------------------------------+-------------------+ b'Query internal execution time: 0.221227 milliseconds'
Sample ^
The above data has been generated with the help of redisgraph
only. We won't need show_data
method for it.
I guess this issue could be taken under coupling hydra-python-agent
to redis
looks fine.
I will open a issue about making the agent leveraging Redis all-over the codebase.
See references to older issues in #99
As specified in those issues, the only data represented in memory in the structure of the API taken from the ApiDoc, the rest is all in the datastore.
show endpoints
classEndpoints + CollectionEndpoints
Class Endpoints
+-----------------+-------------+------------------------------+---------------------------+
| b'p.properties' | b'p.type' | b'p.id' | b'p.operations' |
+-----------------+-------------+------------------------------+---------------------------+
| b"['Location']" | b'Location' | b'vocab:EntryPoint/Location' | b"['POST', 'PUT', 'GET']" |
+-----------------+-------------+------------------------------+---------------------------+b'Query internal execution time: 0.231691 milliseconds'
Collection Endpoints
+----------------------------+---------------------------------------------+-------------------+
| b'p.type' | b'p.id' | b'p.operations' |
+----------------------------+---------------------------------------------+-------------------+
| b'DroneCollection' | b'vocab:EntryPoint/DroneCollection' | b"['GET', 'PUT']" |
| b'DatastreamCollection' | b'vocab:EntryPoint/DatastreamCollection' | b"['GET', 'PUT']" |
| b'CommandCollection' | b'vocab:EntryPoint/CommandCollection' | b"['GET', 'PUT']" |
| b'AnomalyCollection' | b'vocab:EntryPoint/AnomalyCollection' | b"['GET', 'PUT']" |
| b'HttpApiLogCollection' | b'vocab:EntryPoint/HttpApiLogCollection' | b"['GET', 'PUT']" |
| b'MessageCollection' | b'vocab:EntryPoint/MessageCollection' | b"['GET', 'PUT']" |
| b'DroneLogCollection' | b'vocab:EntryPoint/DroneLogCollection' | b"['GET', 'PUT']" |
| b'ControllerLogCollection' | b'vocab:EntryPoint/ControllerLogCollection' | b"['GET', 'PUT']" |
+----------------------------+---------------------------------------------+-------------------+b'Query internal execution time: 0.221227 milliseconds'
Sample ^
The above data has been generated with the help ofredisgraph
only. We won't needshow_data
method for it.
I guess this issue could be taken under couplinghydra-python-agent
to redis
We have to use this data in demo/UI. This format may be difficult to handle it there otherwise it look fine. But I think redisgraph has updated the query output, so we also need to update or improve the printing method.