Difference between revisions of "Gremlin python"

From BITPlan Wiki
Jump to navigation Jump to search
Line 27: Line 27:
 
* http://tinkerpop.apache.org/downloads.html
 
* http://tinkerpop.apache.org/downloads.html
 
= Installation helper script =
 
= Installation helper script =
 +
The installation helper script tries to automate the necessary steps
 +
#    Installation
 +
#    Gremlin-Server start
 +
#    Gremlin-Console start (for debugging)
 +
#    Python script start
 +
 
<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 34: Line 40:
 
./run -p
 
./run -p
 
</source>
 
</source>
 +
 +
== Help ==
 +
<source lang='bash'>
 +
./run -h
 +
usage: ./run  [-h|-i|-s|-c]
 +
  -h|--help: show this usage
 +
  -i|--install: install prerequisites
 +
  -s|--server: start server
 +
  -c|--console: start console
 +
  -p|--python: start python trial code
 +
</source>
 +
 +
==Installation==
 +
<source lang='bash'>
 +
run -i
 +
</source>
 +
installs
 +
 +
#gremlin server
 +
#gremlin console
 +
#gremlin python module
 +
 +
==Gremlin-Server start==
 +
<source lang='bash'>
 +
./run -s
 +
</source>
 +
starts the gremlin server with a default yaml-file in foreground
 +
 +
==Gremlin-Console start (for debugging)==
 +
<source lang='bash'>
 +
./run -c
 +
</source>
 +
starts the gremlin console
 +
 +
==Python script start==
 +
<source lang='bash'>
 +
./run -p
 +
</source>
 +
starts the python test script.

Revision as of 14:27, 17 September 2019

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

  1. Java
  2. Python
  3. Gremlin-Server
  4. Gremlin-Console (for debugging)

Installing Java

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

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 Server and Console

Installation helper script

The installation helper script tries to automate the necessary steps

  1. Installation
  2. Gremlin-Server start
  3. Gremlin-Console start (for debugging)
  4. Python script start
git clone https://github.com/WolfgangFahl/gremlin-python-tutorial
./run -i
./run -s
# in another console
./run -p

Help

./run -h
usage: ./run  [-h|-i|-s|-c]
  -h|--help: show this usage
  -i|--install: install prerequisites
  -s|--server: start server
  -c|--console: start console
  -p|--python: start python trial code

Installation

 run -i

installs

  1. gremlin server
  2. gremlin console
  3. 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.