Azure-Samples / cosmos-notebooks

Sample Notebooks
24 stars 28 forks source link

Adding Gremlin notebook #33

Closed LuisBosquez closed 4 years ago

LuisBosquez commented 4 years ago

Purpose

Adds the Gremlin introduction notebook

Does this introduce a breaking change?

[ ] Yes
[X] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[X] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Documentation content changes
[ ] Other... Please describe:

How to Test

git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
npm install

What to Check

Verify that the following are valid

Other Information

Mimetis commented 4 years ago

Hello @LuisBosquez Thanks for your PR; it's exactly what I was searching for :)

Infortunately, it does not work on my CosmosDB graph database.

During the task Client Initialization I have a couple of errors raised

from gremlin_python.driver import client, serializer

client = client.Client(
        'wss://spertus.gremlin.cosmos.azure.com:443/','g', 
        username="/dbs/graphdb/colls/Persons",
        password="kq.......Q==",
        message_serializer=serializer.GraphSONSerializersV2d0()
)

The error looks like:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
     50             try:
---> 51                 from gremlin_python.driver.tornado.transport import (
     52                     TornadoTransport)

---> 19 from tornado import ioloop, websocket

---> 28 import tornado.web

---> 86 from tornado import httputil

---> 36 from tornado.util import ObjectDict, PY3

ImportError: cannot import name 'PY3'

Exception: Please install Tornado or passcustom transport factory

I tried to import Tornado in the import task, but it was already part of the packages installed:

import sys, traceback
!{sys.executable} -m pip install gremlinpython==3.4.3 --user
!{sys.executable} -m pip install futures --user
!{sys.executable} -m pip install networkx --user
!{sys.executable} -m pip install tornado --user

print(sys.version)

Output:

Requirement already satisfied: gremlinpython in ./.local/lib/python3.6/site-packages (3.4.3)
Requirement already satisfied: aenum>=1.4.5 in ./.local/lib/python3.6/site-packages (from gremlinpython) (2.2.3)
Requirement already satisfied: tornado<5.0,>=4.4.1 in ./.local/lib/python3.6/site-packages (from gremlinpython) (4.5.3)
Requirement already satisfied: six>=1.10.0 in ./.local/lib/python3.6/site-packages (from gremlinpython) (1.12.0)
Requirement already satisfied: isodate>=0.6.0 in ./.local/lib/python3.6/site-packages (from gremlinpython) (0.6.0)
Requirement already satisfied: futures in ./.local/lib/python3.6/site-packages (3.1.1)
Requirement already satisfied: networkx in ./.local/lib/python3.6/site-packages (2.4)
Requirement already satisfied: decorator>=4.3.0 in ./.local/lib/python3.6/site-packages (from networkx) (4.4.0)
Requirement already satisfied: tornado in ./.local/lib/python3.6/site-packages (4.5.3)
3.6.8 (default, Oct  7 2019, 12:59:55) 
[GCC 8.3.0]

Any thought ?

LuisBosquez commented 4 years ago

@Mimetis thanks for trying it out. Some customers have reported working around this error by restarting the kernel after installing the packages. Could you try that? image

Mimetis commented 4 years ago

Indeed !! It worked once restarted.

Thanks for the tip :) You should mention this behavior in the doc, I guess :)