Skip to content

Commit 351531d

Browse files
committed
Replace incorrect CsText use with CsJsonb
1 parent 02d9442 commit 351531d

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

languages/python/jupyter_notebook/CipherStash-Getting-Started.ipynb

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@
262262
"cell_type": "code",
263263
"execution_count": null,
264264
"id": "4e7763c1-4155-4fe3-ab40-ef359adb7ca8",
265-
"metadata": {},
265+
"metadata": {
266+
"scrolled": true
267+
},
266268
"outputs": [],
267269
"source": [
268270
"%env PGPASSWORD=postgres\n",
@@ -300,7 +302,9 @@
300302
"cell_type": "code",
301303
"execution_count": null,
302304
"id": "56e04d28-4ebc-463a-b7d0-1ea3cf843f1b",
303-
"metadata": {},
305+
"metadata": {
306+
"scrolled": true
307+
},
304308
"outputs": [],
305309
"source": [
306310
"%env PGPASSWORD=postgres\n",
@@ -431,9 +435,7 @@
431435
"cell_type": "code",
432436
"execution_count": null,
433437
"id": "698c6970-62f0-4cfb-b779-7a5dbbe11d3a",
434-
"metadata": {
435-
"scrolled": true
436-
},
438+
"metadata": {},
437439
"outputs": [],
438440
"source": [
439441
"from pprint import pprint\n",
@@ -857,7 +859,7 @@
857859
"source": [
858860
"query = \"SELECT cs_ste_vec_value_v1(encrypted_jsonb, %s) AS val FROM examples\"\n",
859861
"\n",
860-
"results = cur.execute(query, (CsText(\"$.top.nested\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),))\n",
862+
"results = cur.execute(query, (CsJsonb(\"$.top.nested\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),))\n",
861863
"\n",
862864
"found = cur.fetchall()\n",
863865
"print(\"values from '$.top.nested':\")\n",
@@ -884,8 +886,8 @@
884886
"\n",
885887
"cur.execute(\n",
886888
" query,\n",
887-
" (CsText(\"$.num\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),\n",
888-
" CsText(\"1\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ste_vec\")\n",
889+
" (CsJsonb(\"$.num\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),\n",
890+
" CsJsonb(1, \"examples\", \"encrypted_jsonb\").to_db_format(\"ste_vec\")\n",
889891
" )\n",
890892
")\n",
891893
"\n",
@@ -917,7 +919,7 @@
917919
"\n",
918920
"cur.execute(\n",
919921
" query,\n",
920-
" (CsText(\"$.num\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),)\n",
922+
" (CsJsonb(\"$.num\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),)\n",
921923
")\n",
922924
"found = cur.fetchall();\n",
923925
"print(\"JSONB contents, ordered by 'num' desc:\")\n",
@@ -947,8 +949,8 @@
947949
"\n",
948950
"cur.execute(\n",
949951
" query,\n",
950-
" (CsText(\"$.category\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),\n",
951-
" CsText(\"$.category\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"))\n",
952+
" (CsJsonb(\"$.category\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"),\n",
953+
" CsJsonb(\"$.category\", \"examples\", \"encrypted_jsonb\").to_db_format(\"ejson_path\"))\n",
952954
")\n",
953955
"\n",
954956
"found = cur.fetchall()\n",

languages/python/jupyter_notebook/cs_types.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
from psycopg2.extras import RealDictCursor
2-
from pprint import pprint
32
from datetime import datetime
43
import json
5-
from enum import Enum
64

75
class CsValue:
86
def __init__(self, v, t: str, c: str):
@@ -99,4 +97,4 @@ def __init__(self, row):
9997
self.row[k] = None
10098
else:
10199
mapping = self.column_function_mapping.get(k, self.id_map)
102-
self.row[k] = mapping(v)
100+
self.row[k] = mapping(v)

0 commit comments

Comments
 (0)