Difference between revisions of "Gremlin python"
Jump to navigation
Jump to search
Line 17: | Line 17: | ||
# Gremlin-Server | # Gremlin-Server | ||
# Gremlin-Console (for debugging) | # Gremlin-Console (for debugging) | ||
− | == Installing Java == | + | |
+ | To get the preqequisites you can either follow the manual or script based installation below. | ||
+ | The script based installation is quicker - the manual installation gives you more insight and control over the installation steps. | ||
+ | == Manual Installation == | ||
+ | === Installing Java === | ||
There are many ways to install Java and your mileage may vary. | There are many ways to install Java and your mileage may vary. | ||
<source lang='bash'> | <source lang='bash'> | ||
Line 27: | Line 31: | ||
</source> | </source> | ||
− | == Installing Python and Pip == | + | === Installing Python and Pip === |
+ | We assume you'd like to work with python 2.7 | ||
<source lang='bash'> | <source lang='bash'> | ||
sudo apt install python2.7 | sudo apt install python2.7 | ||
Line 36: | Line 41: | ||
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7) | pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7) | ||
</source> | </source> | ||
− | == Installing Gremlin-Python == | + | === Installing Gremlin-Python === |
<source lang='bash'> | <source lang='bash'> | ||
sudo -H pip install -r requirements.txt | sudo -H pip install -r requirements.txt | ||
</source> | </source> | ||
− | = Installing Gremlin Server and Console = | + | === Installing Gremlin Server and Console === |
* http://tinkerpop.apache.org/downloads.html | * http://tinkerpop.apache.org/downloads.html | ||
− | = | + | == Script based installation == |
− | The installation helper script tries to automate the necessary steps | + | The "run" installation helper script tries to automate the necessary steps |
# Installation | # Installation | ||
# Gremlin-Server start | # Gremlin-Server start | ||
Line 49: | Line 54: | ||
# Python script start | # Python script start | ||
+ | The following command should get you going: | ||
<source lang='bash'> | <source lang='bash'> | ||
git clone https://github.com/WolfgangFahl/gremlin-python-tutorial | git clone https://github.com/WolfgangFahl/gremlin-python-tutorial | ||
Line 57: | Line 63: | ||
</source> | </source> | ||
− | == Help == | + | === Help === |
<source lang='bash'> | <source lang='bash'> | ||
./run -h | ./run -h | ||
Line 68: | Line 74: | ||
-v|--version: show version | -v|--version: show version | ||
</source> | </source> | ||
− | == Version == | + | === Version === |
<source lang='bash'> | <source lang='bash'> | ||
./run -v | ./run -v | ||
Line 74: | Line 80: | ||
</source> | </source> | ||
− | ==Installation== | + | ===Installation=== |
<source lang='bash'> | <source lang='bash'> | ||
run -i | run -i | ||
Line 84: | Line 90: | ||
#gremlin python module | #gremlin python module | ||
− | ==Gremlin-Server start== | + | ===Gremlin-Server start=== |
<source lang='bash'> | <source lang='bash'> | ||
./run -s | ./run -s | ||
Line 90: | Line 96: | ||
starts the gremlin server with a default yaml-file in foreground | starts the gremlin server with a default yaml-file in foreground | ||
− | ==Gremlin-Console start (for debugging)== | + | ===Gremlin-Console start (for debugging)=== |
<source lang='bash'> | <source lang='bash'> | ||
./run -c | ./run -c | ||
Line 96: | Line 102: | ||
starts the gremlin console | starts the gremlin console | ||
− | ==Python script start== | + | ===Python script start=== |
<source lang='bash'> | <source lang='bash'> | ||
./run -p | ./run -p | ||
</source> | </source> | ||
starts the python test script. | starts the python test script. |
Revision as of 15:10, 17 September 2019
OsProject | |
---|---|
edit | |
id | gremlin-python-tutorial |
state | |
owner | WolfgangFahl |
title | Gremlin-Python mini tutorial |
url | https://github.com/WolfgangFahl/gremlin-python-tutorial |
version | 0.0.1 |
description | |
date | 2019-09-17 |
since | |
until |
This mini-tutorial is inspired by this stackoverflow question
The goal is to get access to an apache tinkerpop/gremlin graph database via Python.
Prerequisites
- Java
- Python
- Gremlin-Server
- Gremlin-Console (for debugging)
To get the preqequisites you can either follow the manual or script based installation below. The script based installation is quicker - the manual installation gives you more insight and control over the installation steps.
Manual Installation
Installing Java
There are many ways to install Java and your mileage may vary.
sudo apt-get install openjdk-8-jre
java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-8u222-b10-1ubuntu1~18.04.1-b10)
OpenJDK 64-Bit Server VM (build 25.222-b10, mixed mode)
Installing Python and Pip
We assume you'd like to work with python 2.7
sudo apt install python2.7
python --version
Python 2.7.15+
sudo apt install python-pip
pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
Installing Gremlin-Python
sudo -H pip install -r requirements.txt
Installing Gremlin Server and Console
Script based installation
The "run" installation helper script tries to automate the necessary steps
- Installation
- Gremlin-Server start
- Gremlin-Console start (for debugging)
- Python script start
The following command should get you going:
git clone https://github.com/WolfgangFahl/gremlin-python-tutorial
./run -i
./run -s
# in another console
./run -p
Help
./run -h
usage: ./run [-c|-h|-i|-p|-s|-v]
-c|--console: start console
-h|--help: show this usage
-i|--install: install prerequisites
-p|--python: start python trial code
-s|--server: start server
-v|--version: show version
Version
./run -v
apache-tinkerpop-gremlin version 3.4.3
Installation
run -i
installs
- gremlin server
- gremlin console
- gremlin python module
Gremlin-Server start
./run -s
starts the gremlin server with a default yaml-file in foreground
Gremlin-Console start (for debugging)
./run -c
starts the gremlin console
Python script start
./run -p
starts the python test script.