Skip to main content

jupyter notebook extension to connect to graph databases

Project description

graph-notebook

Python package integrating Jupyter notebooks with various graph-stores including Apache TinkerPop and RDF SPARQL.

Requirements

  • Python 3.6.1 or higher, Python 3.7
  • Jupyter Notebook

Introduction

The graph-notebook provides a way to interact using a Jupyter notebook with any graph database that follows the Gremlin Server or RDF HTTP protocols. These databases could be running locally on your laptop, in a private data center or in the cloud. This project was initially created as a way to work with Amazon Neptune but is not limited to that database engine. For example you can connect to a Gremlin Server running on your laptop using this solution. The instructions below describe the process for connecting to Amazon Neptune. We encourage others to contribute configurations they find useful. There is an additional-databases folder where such information can be found.

Installation

# install the package
pip install graph-notebook

# install and enable the visualization widget
jupyter nbextension install --py --sys-prefix graph_notebook.widgets
jupyter nbextension enable  --py --sys-prefix graph_notebook.widgets

# copy static html resources
python -m graph_notebook.static_resources.install
python -m graph_notebook.nbextensions.install

# copy premade starter notebooks
python -m graph_notebook.notebooks.install --destination /notebook/destination/dir  

# start jupyter
jupyter notebook /notebook/destination/dir

Configuration

In order to connect to your graph database, you have three configuration options.

  1. Change the host setting in your opened Jupyter notebook by running the following in a notebook cell:
%graph_notebook_host you-endpoint-here
  1. Change your configuration entirely grabbing the current configuration, making edits, and saving it to your notebook by running the following cells:
# 1. print your configuration
%graph_notebook_config

# default config will be printed if nothing else is set:
{
    "host": "change-me",
    "port": 8182,
    "auth_mode": "DEFAULT",
    "iam_credentials_provider_type": "ROLE",
    "load_from_s3_arn": "",
    "ssl": true,
    "aws_region": "us-east-1"
}

# 2. in a new cell, change the configuration by using %%graph_notebook_config (note the two leading %% instead of one)
%%graph_notebook_config
{
  "host": "changed-my-endpoint",
  "port": 8182,
  "auth_mode": "DEFAULT",
  "iam_credentials_provider_type": "ENV",
  "load_from_s3_arn": "",
  "ssl": true,
  "aws_region": "us-east-1"
}
  1. Store a configuration under ~/graph_notebook_config.json
echo "{
  "host": "changed-my-endpoint",
  "port": 8182,
  "auth_mode": "DEFAULT",
  "iam_credentials_provider_type": "ENV",
  "load_from_s3_arn": "",
  "ssl": true,
  "aws_region": "us-east-1"
}" >> ~/graph_notebook_config.json

Connecting to a local graph store

As mentioned in the introduction, it is possible to connect graph-notebook to a graph database running on your local machine, an example being Gremlin Server. There are additional instructions regarding the use of local servers in the additional-databases folder.

Authentication

If you are running a SigV4 authenticated endpoint, ensure that the config field iam_credentials_provider_type is set to ENV and that you have set the following environment variables:

  • AWS_ACCESS_KEY_ID
  • AWS_SECRET_ACCESS_KEY
  • AWS_REGION
  • AWS_SESSION_TOKEN (OPTIONAL. Use if you are using temporary credentials)

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

graph-notebook-1.34.0.dev0.tar.gz (61.6 MB view details)

Uploaded Source

Built Distribution

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

graph_notebook-1.34.0.dev0-py3-none-any.whl (8.1 MB view details)

Uploaded Python 3

File details

Details for the file graph-notebook-1.34.0.dev0.tar.gz.

File metadata

  • Download URL: graph-notebook-1.34.0.dev0.tar.gz
  • Upload date:
  • Size: 61.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.5

File hashes

Hashes for graph-notebook-1.34.0.dev0.tar.gz
Algorithm Hash digest
SHA256 1761d140afa932e98a38e6f551b53c5e93d49999d1746025be14920c0c2c6e49
MD5 d0fbb11b14de5b312af4e786749fc897
BLAKE2b-256 060e59641d10b3172af062512eb7fbb5e86c48d0e53f3117a78668eb796bfff5

See more details on using hashes here.

File details

Details for the file graph_notebook-1.34.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: graph_notebook-1.34.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.6.5

File hashes

Hashes for graph_notebook-1.34.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ea07951b27b22b094bf5a387178e69b94fd40521809e94781ffad83fae72e94
MD5 247d6f03b8cb15cb08d945214c8a7ab5
BLAKE2b-256 3785325e97d6af5dda472fa56d43f12be78b49b22e47f8906d0a5019ac09a9f9

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