Skip to main content

Cypher magic for IPython

Project description

cypher magic

Based on the code from https://github.com/innovationOUtside/cypher_magic.git but now more complete .

  • pip install --upgrade git+https://github.com/petehughes/cypher_magic.git

Load the magic with:

%load_ext cypher_magic

The magic allows you to run Cypher commands against the connected database using default credentials

  • You can set the host name of the neo4j using the -s/--server variable. default is localhost
  • You can set the username with the -u/--userName variable. default is neo4j
  • You can change the password with the -p/--password variable.
  • the -q flag suppresses the cell output.
  • the -o/--output set the output type:
    • default: pandas dataframe
    • raw: response from the py2neo
    • table,
    • matrix - requires sympy
    • graph
%cypher -r
%cypher -q -p password -u neo4j -s localhost

Call as line magic %cypher or block magic: %%cypher

p = %cypher -o table MATCH (p:Person) RETURN p.name AS name

or

%%cypher -o table
MATCH (p:Person)
RETURN p.name AS name

the magic will return a pandas dataframe by default. Other return formats, set using the -o/--output parameter, include table and matrix (the latter requires sympy to be installed).

graph output options:

the graph output can be tailored by using a number of options:

{
    "label of node or type of edge": "attribute name to use to describe it"
}

eg

{"Person":"FullName" }

complex: the graph output can be tailored by using a number of options:

{
    "label of node or type of edge": {
        "label":"attribute name to use to describe it",
        "opacity":"the opacity",
        "width":"the width of the relationship line", // relationship only
        "color": "the colour",
        "colorValue": "the value in the relationship that defines the color",
        "image": "url to the image" // node only
        "shape": "the type of shape" // node only
        "noArrows": "remove all the arrows from showing" // relationship only
    }
}

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

magic-cypher-0.9.2.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

magic_cypher-0.9.2-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file magic-cypher-0.9.2.tar.gz.

File metadata

  • Download URL: magic-cypher-0.9.2.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for magic-cypher-0.9.2.tar.gz
Algorithm Hash digest
SHA256 3dc372f292de8e436c889d4acf1c4204bb2c585c418479ed9c74b8c505f19e20
MD5 aae64659c2a9982207928a7891d6dc70
BLAKE2b-256 ad9e4b0798ef2ee0d3ccad715ba32c1fc063f12926af24de7b14348c31b14ee0

See more details on using hashes here.

File details

Details for the file magic_cypher-0.9.2-py3-none-any.whl.

File metadata

  • Download URL: magic_cypher-0.9.2-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for magic_cypher-0.9.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9856542a55790622954037a4804f9b6c21d8f981fb4e0f7566bb5af21e36804e
MD5 bf3132f7cfec28299987c39b5ac777a0
BLAKE2b-256 02f5d7896b3cc8013ee46687021e93506fd51ead491dc7bb8e9fd4b1418e618e

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