grandlite


Namegrandlite JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryA command-line tool for querying graphs using common query languages.
upload_time2023-05-16 10:28:30
maintainer
docs_urlNone
authorJordan Matelsky
requires_python>=3.10,<4.0
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://github.com/aplbrain/grand).

## Installation

```bash
$ pip install grandlite
```

## Usage

```bash
$ 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

```bash
$ 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

```bash
$ 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

```bash
$ 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
```

---

<p align='center'><small>Made with 💙 at <a href='http://www.jhuapl.edu/'><img alt='JHU APL' align='center' src='https://user-images.githubusercontent.com/693511/62956859-a967ca00-bdc1-11e9-998e-3888e8a24e86.png' height='42px'></a></small></p>

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "grandlite",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Jordan Matelsky",
    "author_email": "opensource@matelsky.com",
    "download_url": "https://files.pythonhosted.org/packages/31/94/ec03ad74cadf081818201677462f9b4696122102086c3ad6d9361210e817/grandlite-0.1.0.tar.gz",
    "platform": null,
    "description": "# grandlite\n\nA SQLite-like tool for querying graphs from the command-line using graph query languages in in-memory Python.\n\nSupports out-of-core graphs with [Grand](https://github.com/aplbrain/grand).\n\n## Installation\n\n```bash\n$ pip install grandlite\n```\n\n## Usage\n\n```bash\n$ grandlite my-graph.graphml\n>\n> match (a)-[]->(b) return a,b limit 10\n\n        a       b\n0  023620  364605\n1  023620  438847\n2  023620  462336\n3  023620  962055\n4  023620  314820\n5  023620  755250\n6  023620  001770\n7  023620  055317\n8  023620  419409\n9  023620  482511\n\n> save results.json\n\n> exit()\n```\n\nNote 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.\n\n## Command-line options\n\n```bash\n$ grandlite --help\nusage: An interactive graph query tool for Cypher and other query languages.\n       [-h] [-o {csv,json,jsonl}] [-c CYPHER] graph\n\npositional arguments:\n  graph                 The filename of the graph to load.\n\noptions:\n  -h, --help            show this help message and exit\n  -o {csv,json,jsonl}, --output {csv,json,jsonl}\n                        The output format to use.\n  -c CYPHER, --cypher CYPHER\n                        A Cypher query to run.\n```\n\n## Examples\n\n#### Non-interactively query a GraphML file and output the results as JSON\n\n```bash\n$ grandlite my-graph.graphml -c 'match (a)-[]->(b) where a.type <> 1 return a,b limit 10' --json\n```\n\n#### Interactively query a graph file downloaded from the internet, automatically inferring the file format\n\n```bash\n$ grandlite https://raw.githubusercontent.com/melaniewalsh/sample-social-network-datasets/master/sample-datasets/quakers/quakers-network.graphml\n\n> match (a) return a, a.size\n                   a  a.size\n0       George Keith    10.0\n1   William Bradford    10.0\n2   George Whitehead    10.0\n3         George Fox    10.0\n4       William Penn    10.0\n..               ...     ...\n91      Joseph Besse    10.0\n92     Samuel Bownas    10.0\n93    Silvanus Bevan    10.0\n94    John Penington    10.0\n95      Lewis Morris    10.0\n```\n\n---\n\n<p align='center'><small>Made with \ud83d\udc99 at <a href='http://www.jhuapl.edu/'><img alt='JHU APL' align='center' src='https://user-images.githubusercontent.com/693511/62956859-a967ca00-bdc1-11e9-998e-3888e8a24e86.png' height='42px'></a></small></p>\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "A command-line tool for querying graphs using common query languages.",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ab17841eed8646eec571b4436e3415cd72adb9974afe09602d0e1469acf50a59",
                "md5": "a127c43078b68133adfaeaad0f175d0c",
                "sha256": "d585676f45514e23472a68ee697a8234472cb43c969698d252b2637d6900b69f"
            },
            "downloads": -1,
            "filename": "grandlite-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a127c43078b68133adfaeaad0f175d0c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 8816,
            "upload_time": "2023-05-16T10:28:29",
            "upload_time_iso_8601": "2023-05-16T10:28:29.088292Z",
            "url": "https://files.pythonhosted.org/packages/ab/17/841eed8646eec571b4436e3415cd72adb9974afe09602d0e1469acf50a59/grandlite-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3194ec03ad74cadf081818201677462f9b4696122102086c3ad6d9361210e817",
                "md5": "fb5ae9ac855d0b174cecb04e30af459c",
                "sha256": "f841267639ea49fe3aa0738a9eeeedd0c3b3cd22210b6f9b65f0c8acfb2c17b5"
            },
            "downloads": -1,
            "filename": "grandlite-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fb5ae9ac855d0b174cecb04e30af459c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 8059,
            "upload_time": "2023-05-16T10:28:30",
            "upload_time_iso_8601": "2023-05-16T10:28:30.976757Z",
            "url": "https://files.pythonhosted.org/packages/31/94/ec03ad74cadf081818201677462f9b4696122102086c3ad6d9361210e817/grandlite-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-16 10:28:30",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "grandlite"
}
        
Elapsed time: 0.08852s