Cheat Sheet
%ngql help
Don't remember anything but one command:
%load_ext ngql
Then you can get help by:
%ngql help
All the magic commands and examples are there for you to copy and paste.
%ngql
Connect & oneliner query
%ngql --address 127.0.0.1 --port 9669 --user root --password nebula
%ngql USE demo_basketballplayer;
%ngql MATCH (v:player{name:"Tim Duncan"})-->(v2:player) RETURN v2.player.name AS Name;
See more from magic_words/ngql.
%%ngql
Multiple lines query
%%ngql
CREATE TAG player(name string, age int);
CREATE EDGE follow(degree int);
See more from magic_words/ngql.
%ngql_load
Load data from CSV
%ng_load --source <source> [--header] --space <space> [--tag <tag>] [--vid <vid>] [--edge <edge>] [--src <src>] [--dst <dst>] [--rank <rank>] [--props <props>] [-b <batch>]
# load CSV from a URL
%ng_load --source https://github.com/wey-gu/jupyter_nebulagraph/raw/main/examples/actor.csv --tag player --vid 0 --props 1:name,2:age --space demo_basketballplayer
# with rank column
%ng_load --source follow_with_rank.csv --edge follow --src 0 --dst 1 --props 2:degree --rank 3 --space basketballplayer
# without rank column
%ng_load --source follow.csv --edge follow --src 0 --dst 1 --props 2:degree --space basketballplayer
See more from magic_words/ng_load.
%ngql_draw
Draw Last Query Result
# one query
%ngql GET SUBGRAPH 2 STEPS FROM "player101" YIELD VERTICES AS nodes, EDGES AS relationships;
%ng_draw
# another query
%ngql match p=(:player)-[]->() return p LIMIT 5
%ng_draw
Draw a Query
Or %ng_draw <one_line_query>, %%ng_draw <multiline_query> instead of drawing the result of the last query.
One line query:
%ng_draw GET SUBGRAPH 2 STEPS FROM "player101" YIELD VERTICES AS nodes, EDGES AS relationships;
Multiple lines query:
%%ng_draw
MATCH path_0=(n)--() WHERE id(n) == "p_0"
OPTIONAL MATCH path_1=(n)--()--()
RETURN path_0, path_1
See more from magic_words/ng_draw.
%ngql_draw_schema
Draw Graph Schema
Note: This call assumes there are data in the graph per each edge type.
%ng_draw_schema
See more from magic_words/ng_draw_schema.