Skip to main content

query graph databases via an interactive console

Project description

graphc

Build status PYPI version Latest Release Commits Since Latest Release

graphc (stands for "graph console") lets you query Neo4j/AWS Neptune databases via an interactive console.

console

💾 Installation

uv tool install graphc

⚡️ Usage

usage: graphc [OPTIONS]

Query Neo4j/AWS Neptune databases via an interactive console

options:
  -h, --help            show this help message and exit
  -q STRING, --query STRING
                        Cypher query to execute. If not provided, starts interactive console
  -d STRING, --db-uri STRING
                        Database URI
  -b, --benchmark       Benchmark query execution times without showing results (only applicable in query mode)
  -n INTEGER, --bench-num-runs INTEGER
                        Number of benchmark runs (default: 5)
  -W INTEGER, --bench-warmup-num-runs INTEGER
                        Number of warmup runs before benchmarking (default: 0)
  --debug               Print debug information without doing anything
  -w, --write           Write query results to file (or start console with 'write results' mode on)
  -f {json,csv}, --format {json,csv}
                        Output file format for query results
  -p, --print-query     Print the query (or start console with 'print query' mode on)
# Interactive mode
export DB_URI='bolt://127.0.0.1:7687'
export DB_USER='user'
export DB_PASSWORD='password'
graphc

graphc -d 'bolt://abc.xyz.us-east-1.neptune.amazonaws.com:8182'

# One-off query mode
graphc --query 'MATCH (n: Node) RETURN n.id, n.name LIMIT 5'

graphc -q - < query.cypher

echo 'MATCH (n: Node) RETURN n.id, n.name LIMIT 5' | graphc -q -

📟 Console

graphc comes with a console where you can execute queries in an interactive manner.

console

Commands

Command(s) Description
help / :h show help
clear clear screen
quit / exit / bye / :q quit
write <FORMAT> turn ON "write results" mode
write off turn OFF "write results" mode
@<filename> execute query from a local file
print <on/off> toggle "print query" mode

Keymaps

Key Description
<esc> enter vim mode
/ k scroll up in query history
/ j scroll down in query history
tab cycle through path suggestions (in insert mode, after @)

✏️ Write mode

graphc lets you save query results to a file in both one-off query mode and console mode.

cat query.cypher | graphc -q - --write

In console mode, use the command write <FORMAT> (format can be csv or json).

write-mode-console

graphc will save results in the directory it's run in, in a subdirectory called .graphc.

🔢 Benchmarking

You can benchmark the execution times for a query using the --benchmark/-b flag.

cat query.cypher | graphc -c - -b -n 5 -w 2
Warming up (2 runs) ...
Warmup  1:   627.84 ms
Warmup  2:   452.06 ms

Benchmarking (5 runs) ...
Run  1:   451.92 ms
Run  2:   449.51 ms
Run  3:   451.52 ms
Run  4:   453.09 ms
Run  5:   445.73 ms

Statistics:
Mean:     450.35 ms
Median:   451.52 ms
Min:      445.73 ms
Max:      453.09 ms

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graphc-0.1.3.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

graphc-0.1.3-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

Details for the file graphc-0.1.3.tar.gz.

File metadata

  • Download URL: graphc-0.1.3.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for graphc-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c5821d488e28f65fd6eadccf88a575998ff31261f15067fc8425c9b1e2e6bc46
MD5 43ed83d5f26d87a0cb13e49781aa332a
BLAKE2b-256 cf832bc6fdea0cd215a1979aa24c400680e30b47cf575b48f1fe6e826453e548

See more details on using hashes here.

File details

Details for the file graphc-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: graphc-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.4

File hashes

Hashes for graphc-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bd820f357a2c19664fa4aa9a6649f82d2cbd61ce58ecb5510f912bb1f2c9ad4f
MD5 711c5ad9120989eb065a9938aea6da30
BLAKE2b-256 887b25e073bc0694ee4a98fe3b1b0765f8685c46004aab7ddd7c95ef191fd749

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page