Start your ClickHouse container, which should be set up in Clickhouse-sample-data
-
Clone OpenDigger
git clone https://github.com/X-lab2017/open-digger.git
-
Enter the repo path
cd open-digger
-
Go to the
python
folder in the open-digger root directory, create a file named 'local_config.py'(this file has already added into.gitignore
file.) for Python Kernel with the following contents:local_config = { 'db': { 'clickhouse': { 'host':'172.17.0.1', 'user':'default' }, 'neo4j':{ 'port': '7687', } } }
the
host
above is the host of the ClickHouse server. We can find it usingdocker inspect container_name
(the container_name is set by command docker run --name xxx), and copy theGateway
like this:$ docker inspect container_name | grep Gateway "Gateway": "172.17.0.1", "IPv6Gateway": "", "Gateway": "172.17.0.1", "IPv6Gateway": "",
If you use your own data, you can also change
host
field to your own host IP -
Use
docker build --build-arg KER_REL_PATH='./python' --build-arg BASE_IMAGE='continuumio/miniconda3' -t opendigger-jupyter-python:1.0 $(pwd)
to make a docker image, this image is based onminiconda
. You can check theDockerfile
in root directory.If you are using Windows CMD, all the
$(pwd)
here should be replaced by%cd%
. And if you are using Windows Powershell, all the$(pwd)
here should be replaced by${pwd}
.Notice: Pathnames of directories like "pwd" may use
\
to join the directory in some versions of Windows. We recommend using absolute paths. -
Then we can use
docker run -i -t --name python_notebook_name --rm -p 8888:8888 -v "$(pwd):/python_kernel/notebook" opendigger-jupyter-python:1.0
to create and run the container. -
Open the link in console log like
http://127.0.0.1:8888/lab?token=xxxxx
. -
If the source code under
python
folder changed, you need to stop the notebook docker usingdocker stop python_notebook_name
and restart the notebook kernel usingdocker run -i -t --name python_notebook_name --rm -p 8888:8888 -v "$(pwd):/python_kernel/notebook" opendigger-jupyter-python:1.0
to reload the sorce code. -
You can find the notebook folder, where we provide demos in the handbook. You can create a new file, and happy data exploring! Attention: you need to do this work in
notebook
or other parallel folder. If you run in root directory, it can't work because of python import rules.
You can also make workspace.py
in python
folder. and run it.