Giter VIP home page Giter VIP logo

neohelper's Introduction

neohelper

Some command line tooling I find helpful when creating/debugging scripts loading Neo4j databases.

Installation

Clone repository, pip3 install neohelper.

Usage

The CLI for this project is built using click.
You can get the list of current commands by just invoking the script neohelper from the command line.

Usage: neohelper [OPTIONS] COMMAND [ARGS]...

  Interface for monitoring and interacting with Neo4j databases. Invoke
  `neohelper command --help` for details on each command.

Options:
  --uri TEXT            Database uri  [default: neo4j://localhost:7687]
  --db_pw_env_var TEXT  Environmental var containing neo4j database password
                        [default: NEO4J_PW]
  --help                Show this message and exit.

Commands:
  count          Display count of nodes and edges database
  count-labels   Count of each node label
  detach-delete  Delete all nodes and relationships in the database
  query          Perform given cypher query, with optional parameters

Each subcommand to the script has its own manual page such as neohelper query --help.

Examples

Json inputs

neohelper query \
"with \$params as jsons
unwind  jsons as json
MERGE (p:Person {
        name : json.name,
            age : json.age
                })
return count(p) as nodes_merged" \
-j '{"name" : "John Jackson", "age" : "45" }' \
-j '{"name" : "Jack Johnson", "age" : "53" }' \
--mode 'write' \
--verbose

should give outputs as:

Input query is:
with $params as jsons
unwind  jsons as json
MERGE (p:Person {
    name : json.name,
    age : json.age
    })
return count(p) as nodes_merged

Parsing json parameters:
{"name" : "John Jackson", "age" : "45" }
{"name" : "Jack Johnson", "age" : "53" }

Results:
{'nodes_merged': 2}

Crude database load monitoring

Use watch command to loop running node counts

watch -n 1 neohelper count-labels

neohelper's People

Contributors

newmanrs avatar

Watchers

 avatar

neohelper's Issues

Databases

Neo4j no longer lets you query the names of databases from outside the system database. This breaks several of the commands in this project.

Add arbitrary query

Implement something like:
neohelper query "ARBITRARY CYPHER QUERY" --params "[{'a' : 'a'}, {'b' : 1}]
so you can create queries with parameters passed to them via this CLI tool.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.