A command-line tool for querying graphs using common query languages.
Project description
grandlite
A SQLite-like tool for querying graphs from the command-line using graph query languages in in-memory Python.
Supports out-of-core graphs with Grand.
Installation
$ pip install grandlite
Usage
$ grandlite my-graph.graphml
>
> match (a)-[]->(b) return a,b limit 10
a b
0 023620 364605
1 023620 438847
2 023620 462336
3 023620 962055
4 023620 314820
5 023620 755250
6 023620 001770
7 023620 055317
8 023620 419409
9 023620 482511
> save results.json
> exit()
Note that save [filename]
will output csv
, json
, and jsonl
files, depending on the extension provided; or will default to results-XXXX.json
with XXX as a timestamp in ISO format, if no filename is provided.
Command-line options
$ grandlite --help
usage: An interactive graph query tool for Cypher and other query languages.
[-h] [-o {csv,json,jsonl}] [-c CYPHER] graph
positional arguments:
graph The filename of the graph to load.
options:
-h, --help show this help message and exit
-o {csv,json,jsonl}, --output {csv,json,jsonl}
The output format to use.
-c CYPHER, --cypher CYPHER
A Cypher query to run.
Examples
Non-interactively query a GraphML file and output the results as JSON
$ grandlite my-graph.graphml -c 'match (a)-[]->(b) where a.type <> 1 return a,b limit 10' --json
Interactively query a graph file downloaded from the internet, automatically inferring the file format
$ grandlite https://raw.githubusercontent.com/melaniewalsh/sample-social-network-datasets/master/sample-datasets/quakers/quakers-network.graphml
> match (a) return a, a.size
a a.size
0 George Keith 10.0
1 William Bradford 10.0
2 George Whitehead 10.0
3 George Fox 10.0
4 William Penn 10.0
.. ... ...
91 Joseph Besse 10.0
92 Samuel Bownas 10.0
93 Silvanus Bevan 10.0
94 John Penington 10.0
95 Lewis Morris 10.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
grandlite-0.1.0.tar.gz
(8.1 kB
view details)
Built Distribution
File details
Details for the file grandlite-0.1.0.tar.gz
.
File metadata
- Download URL: grandlite-0.1.0.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.0 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f841267639ea49fe3aa0738a9eeeedd0c3b3cd22210b6f9b65f0c8acfb2c17b5 |
|
MD5 | fb5ae9ac855d0b174cecb04e30af459c |
|
BLAKE2b-256 | 3194ec03ad74cadf081818201677462f9b4696122102086c3ad6d9361210e817 |
File details
Details for the file grandlite-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: grandlite-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.10.0 Darwin/21.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d585676f45514e23472a68ee697a8234472cb43c969698d252b2637d6900b69f |
|
MD5 | a127c43078b68133adfaeaad0f175d0c |
|
BLAKE2b-256 | ab17841eed8646eec571b4436e3415cd72adb9974afe09602d0e1469acf50a59 |