Skip to main content

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
    }
}

Metadata

Release files for magic-cypher 0.9.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magic-cypher 0.9.2
File Size Uploaded
magic-cypher-0.9.2.tar.gz 6.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magic-cypher 0.9.2
File Interpreter ABI Platform
magic_cypher-0.9.2-py3-none-any.whl Python 3 none any Details

Total release size: 13.9 kB

Release files / magic-cypher-0.9.2.tar.gz

Download URL magic-cypher-0.9.2.tar.gz
Size 6.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3dc372f292de8e436c889d4acf1c4204bb2c585c418479ed9c74b8c505f19e20
BLAKE2b-256 checksum
How to use checksums
ad9e4b0798ef2ee0d3ccad715ba32c1fc063f12926af24de7b14348c31b14ee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release files / magic_cypher-0.9.2-py3-none-any.whl

Download URL magic_cypher-0.9.2-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9856542a55790622954037a4804f9b6c21d8f981fb4e0f7566bb5af21e36804e
BLAKE2b-256 checksum
How to use checksums
02f5d7896b3cc8013ee46687021e93506fd51ead491dc7bb8e9fd4b1418e618e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.4

Release history Release notifications | RSS feed

This release

0.9.2 This release

2 release files

0.9.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page