Skip to content

Commit 0defff9

Browse files
committed
Update kwargs for where
1 parent 1a8ad79 commit 0defff9

File tree

2 files changed

+38
-37
lines changed

2 files changed

+38
-37
lines changed

gqlalchemy-workshop/solutions/gqlalchemy-solutions.ipynb

+9-9
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
},
7676
{
7777
"cell_type": "code",
78-
"execution_count": 4,
78+
"execution_count": 3,
7979
"metadata": {},
8080
"outputs": [
8181
{
@@ -92,7 +92,7 @@
9292
" .node(labels=\"Movie\", variable=\"m\")\n",
9393
" .to(\"OF_GENRE\")\n",
9494
" .node(labels=\"Genre\", variable=\"g\")\n",
95-
" .where(\"m.title\", \"=\", \"Matrix, The (1999)\")\n",
95+
" .where(item=\"m.title\", operator=\"=\", literal=\"Matrix, The (1999)\")\n",
9696
" .return_(results={\"count(g)\": \"num_of_genres\"})\n",
9797
" .execute()\n",
9898
")\n",
@@ -126,7 +126,7 @@
126126
},
127127
{
128128
"cell_type": "code",
129-
"execution_count": 6,
129+
"execution_count": 4,
130130
"metadata": {},
131131
"outputs": [
132132
{
@@ -374,7 +374,7 @@
374374
" .node(labels=\"User\", variable=\"u\")\n",
375375
" .to(\"RATED\")\n",
376376
" .node(labels=\"Movie\", variable=\"m\")\n",
377-
" .where(\"u.id\", \"=\", 1)\n",
377+
" .where(item=\"u.id\", operator=\"=\", literal=1)\n",
378378
" .return_(results={\"m.title\": \"movie\"})\n",
379379
" .execute()\n",
380380
")\n",
@@ -411,7 +411,7 @@
411411
},
412412
{
413413
"cell_type": "code",
414-
"execution_count": 7,
414+
"execution_count": 5,
415415
"metadata": {
416416
"scrolled": true
417417
},
@@ -444,12 +444,12 @@
444444
" .node(labels=\"Movie\", variable=\"m\")\n",
445445
" .to(\"OF_GENRE\")\n",
446446
" .node(labels=\"Genre\", variable=\"g1\")\n",
447-
" .where(\"g1.name\", \"=\", \"Documentary\")\n",
447+
" .where(item=\"g1.name\", operator=\"=\", literal=\"Documentary\")\n",
448448
" .match()\n",
449449
" .node(labels=\"Movie\", variable=\"m\")\n",
450450
" .to(\"OF_GENRE\")\n",
451451
" .node(labels=\"Genre\", variable=\"g2\")\n",
452-
" .where(\"g2.name\", \"=\", \"Comedy\")\n",
452+
" .where(item=\"g2.name\", operator=\"=\", literal=\"Comedy\")\n",
453453
" .return_(results={\"m.title\": \"movie\"})\n",
454454
" .order_by(\"m.title DESC\")\n",
455455
" .limit(15)\n",
@@ -485,7 +485,7 @@
485485
},
486486
{
487487
"cell_type": "code",
488-
"execution_count": 8,
488+
"execution_count": 6,
489489
"metadata": {},
490490
"outputs": [
491491
{
@@ -502,7 +502,7 @@
502502
" .node(labels=\"User\")\n",
503503
" .to(\"RATED\", variable=\"r\")\n",
504504
" .node(labels=\"Movie\", variable=\"m\")\n",
505-
" .where(\"m.title\", \"=\", \"Star Wars: Episode I - The Phantom Menace (1999)\")\n",
505+
" .where(item=\"m.title\", operator=\"=\", literal=\"Star Wars: Episode I - The Phantom Menace (1999)\")\n",
506506
" .return_(results={\"min(r.rating)\": \"min_rating\"})\n",
507507
" .execute()\n",
508508
")\n",

gqlalchemy-workshop/workshop/gqlalchemy-workshop.ipynb

+29-28
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
},
322322
{
323323
"cell_type": "code",
324-
"execution_count": 4,
324+
"execution_count": 5,
325325
"id": "93a1c2a2",
326326
"metadata": {},
327327
"outputs": [],
@@ -339,7 +339,7 @@
339339
},
340340
{
341341
"cell_type": "code",
342-
"execution_count": 5,
342+
"execution_count": 6,
343343
"id": "9f68fcb0",
344344
"metadata": {},
345345
"outputs": [],
@@ -349,7 +349,7 @@
349349
},
350350
{
351351
"cell_type": "code",
352-
"execution_count": 6,
352+
"execution_count": 7,
353353
"id": "1ffcea1a",
354354
"metadata": {},
355355
"outputs": [
@@ -382,7 +382,7 @@
382382
},
383383
{
384384
"cell_type": "code",
385-
"execution_count": 7,
385+
"execution_count": 8,
386386
"id": "53c11afe",
387387
"metadata": {
388388
"scrolled": false
@@ -445,7 +445,7 @@
445445
},
446446
{
447447
"cell_type": "code",
448-
"execution_count": 8,
448+
"execution_count": 9,
449449
"id": "0dfccf29",
450450
"metadata": {
451451
"scrolled": true
@@ -481,7 +481,7 @@
481481
},
482482
{
483483
"cell_type": "code",
484-
"execution_count": 9,
484+
"execution_count": 10,
485485
"id": "72d4e770",
486486
"metadata": {},
487487
"outputs": [
@@ -514,7 +514,7 @@
514514
},
515515
{
516516
"cell_type": "code",
517-
"execution_count": 10,
517+
"execution_count": 11,
518518
"id": "43e50fd0",
519519
"metadata": {
520520
"scrolled": true
@@ -524,7 +524,7 @@
524524
"name": "stdout",
525525
"output_type": "stream",
526526
"text": [
527-
"<Rated id=0 start_node_id=0 end_node_id=1 nodes=(0, 1) type=RATED properties={'rating': 5.0, 'timestamp': 1656684322.120342}>\n"
527+
"<Rated id=0 start_node_id=0 end_node_id=1 nodes=(0, 1) type=RATED properties={'rating': 5.0, 'timestamp': 1656867094.877344}>\n"
528528
]
529529
}
530530
],
@@ -562,7 +562,7 @@
562562
},
563563
{
564564
"cell_type": "code",
565-
"execution_count": 11,
565+
"execution_count": 12,
566566
"id": "dae2543a",
567567
"metadata": {},
568568
"outputs": [],
@@ -604,7 +604,7 @@
604604
},
605605
{
606606
"cell_type": "code",
607-
"execution_count": 12,
607+
"execution_count": 14,
608608
"id": "c40e8239",
609609
"metadata": {},
610610
"outputs": [],
@@ -630,7 +630,7 @@
630630
},
631631
{
632632
"cell_type": "code",
633-
"execution_count": 13,
633+
"execution_count": 15,
634634
"id": "f9434a5e",
635635
"metadata": {},
636636
"outputs": [],
@@ -679,7 +679,7 @@
679679
},
680680
{
681681
"cell_type": "code",
682-
"execution_count": 14,
682+
"execution_count": 16,
683683
"id": "837c4220",
684684
"metadata": {},
685685
"outputs": [],
@@ -696,7 +696,7 @@
696696
},
697697
{
698698
"cell_type": "code",
699-
"execution_count": 15,
699+
"execution_count": 17,
700700
"id": "87dfd43d",
701701
"metadata": {
702702
"scrolled": false
@@ -736,7 +736,7 @@
736736
},
737737
{
738738
"cell_type": "code",
739-
"execution_count": 16,
739+
"execution_count": 18,
740740
"id": "8c77df3b",
741741
"metadata": {
742742
"scrolled": true
@@ -770,7 +770,7 @@
770770
},
771771
{
772772
"cell_type": "code",
773-
"execution_count": 25,
773+
"execution_count": 19,
774774
"id": "f8721836",
775775
"metadata": {
776776
"scrolled": false
@@ -836,7 +836,7 @@
836836
},
837837
{
838838
"cell_type": "code",
839-
"execution_count": 26,
839+
"execution_count": 20,
840840
"id": "cffbded6",
841841
"metadata": {
842842
"scrolled": true
@@ -888,7 +888,7 @@
888888
},
889889
{
890890
"cell_type": "code",
891-
"execution_count": 36,
891+
"execution_count": 26,
892892
"id": "9ee1b6ce",
893893
"metadata": {
894894
"scrolled": true
@@ -908,11 +908,12 @@
908908
" .node(labels=\"User\", variable=\"u\")\n",
909909
" .to(\"RATED\")\n",
910910
" .node(labels=\"Movie\", variable=\"m\")\n",
911-
" .where(\"m.title\", \"=\", \"Home Alone (1990)\")\n",
912-
" .return_(results={\"count(u)\": \"num_of_users\"})\n",
911+
" .where(item=\"m.title\", operator=\"=\", literal=\"Home Alone (1990)\")\n",
912+
" .return_({\"count(u)\": \"num_of_users\"})\n",
913913
" .execute()\n",
914914
")\n",
915915
"\n",
916+
"\n",
916917
"results = list(home_alone)\n",
917918
"\n",
918919
"for result in results:\n",
@@ -944,7 +945,7 @@
944945
},
945946
{
946947
"cell_type": "code",
947-
"execution_count": 37,
948+
"execution_count": 27,
948949
"id": "1bb4116b",
949950
"metadata": {
950951
"scrolled": true
@@ -966,7 +967,7 @@
966967
" .node(labels=\"Movie\", variable=\"m\")\n",
967968
" .to(\"OF_GENRE\")\n",
968969
" .node(labels=\"Genre\", variable=\"g\")\n",
969-
" .where(\"m.title\", \"=\", \"Blue Lagoon, The (1980)\")\n",
970+
" .where(item=\"m.title\", operator=\"=\", literal=\"Blue Lagoon, The (1980)\")\n",
970971
" .return_(results={\"g.name\": \"genre\"})\n",
971972
" .execute()\n",
972973
")\n",
@@ -1005,7 +1006,7 @@
10051006
},
10061007
{
10071008
"cell_type": "code",
1008-
"execution_count": 41,
1009+
"execution_count": 28,
10091010
"id": "10814649",
10101011
"metadata": {},
10111012
"outputs": [
@@ -1032,12 +1033,12 @@
10321033
" .node(labels=\"Movie\", variable=\"m\")\n",
10331034
" .to(\"OF_GENRE\")\n",
10341035
" .node(labels=\"Genre\", variable=\"g1\")\n",
1035-
" .where(\"g1.name\", \"=\", \"Action\")\n",
1036+
" .where(item=\"g1.name\", operator=\"=\", literal=\"Action\")\n",
10361037
" .match()\n",
10371038
" .node(labels=\"Movie\", variable=\"m\")\n",
10381039
" .to(\"OF_GENRE\")\n",
10391040
" .node(labels=\"Genre\", variable=\"g2\")\n",
1040-
" .where(\"g2.name\", \"=\", \"Comedy\")\n",
1041+
" .where(item=\"g2.name\", operator=\"=\", literal=\"Comedy\")\n",
10411042
" .return_(results={\"m.title\": \"movie\"})\n",
10421043
" .order_by(properties=\"m.title\")\n",
10431044
" .limit(10)\n",
@@ -1077,7 +1078,7 @@
10771078
},
10781079
{
10791080
"cell_type": "code",
1080-
"execution_count": 43,
1081+
"execution_count": 29,
10811082
"id": "536c3eaa",
10821083
"metadata": {},
10831084
"outputs": [
@@ -1095,7 +1096,7 @@
10951096
" .node(labels=\"User\")\n",
10961097
" .to(\"RATED\", variable=\"r\")\n",
10971098
" .node(labels=\"Movie\", variable=\"m\")\n",
1098-
" .where(\"m.title\", \"=\", \"Star Wars: Episode IV - A New Hope (1977)\")\n",
1099+
" .where(item=\"m.title\", operator=\"=\", literal=\"Star Wars: Episode IV - A New Hope (1977)\")\n",
10991100
" .return_(results={\"avg(r.rating)\": \"average_rating\"})\n",
11001101
" .execute()\n",
11011102
")\n",
@@ -1128,7 +1129,7 @@
11281129
},
11291130
{
11301131
"cell_type": "code",
1131-
"execution_count": 44,
1132+
"execution_count": 30,
11321133
"id": "43e2f45a",
11331134
"metadata": {},
11341135
"outputs": [
@@ -1455,7 +1456,7 @@
14551456
},
14561457
{
14571458
"cell_type": "code",
1458-
"execution_count": 45,
1459+
"execution_count": 31,
14591460
"id": "59578757",
14601461
"metadata": {
14611462
"scrolled": true

0 commit comments

Comments
 (0)