You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/python-udf-template/notebook.ipynb
+18-18Lines changed: 18 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@
17
17
]
18
18
},
19
19
{
20
-
"id": "bd0ae268",
20
+
"id": "740cef75",
21
21
"cell_type": "markdown",
22
22
"metadata": {},
23
23
"source": [
@@ -41,27 +41,26 @@
41
41
{
42
42
"attachments": {},
43
43
"cell_type": "markdown",
44
-
"id": "bcb6e6a7",
45
44
"metadata": {},
46
45
"source": [
47
46
"This Jupyter notebook will help you build your first Python UDF using Notebooks, registering it with your database and calling it as part of SQL query."
48
-
]
47
+
],
48
+
"id": "ffb6485e"
49
49
},
50
50
{
51
51
"attachments": {},
52
52
"cell_type": "markdown",
53
-
"id": "5776ded1",
54
53
"metadata": {},
55
54
"source": [
56
55
"## Create some simple tables\n",
57
56
"\n",
58
57
"This setup establishes a basic relational structure to store some reviews for restaurants. Ensure you have selected a database."
59
-
]
58
+
],
59
+
"id": "e048901e"
60
60
},
61
61
{
62
62
"cell_type": "code",
63
63
"execution_count": 1,
64
-
"id": "2bbf6a44",
65
64
"metadata": {},
66
65
"outputs": [],
67
66
"source": [
@@ -74,7 +73,8 @@
74
73
" store_name VARCHAR(255) NOT NULL,\n",
75
74
" review TEXT NOT NULL\n",
76
75
");"
77
-
]
76
+
],
77
+
"id": "9da8c576"
78
78
},
79
79
{
80
80
"attachments": {},
@@ -103,13 +103,13 @@
103
103
{
104
104
"attachments": {},
105
105
"cell_type": "markdown",
106
-
"id": "d58c8382",
107
106
"metadata": {},
108
107
"source": [
109
108
"## Define Python UDF functions\n",
110
109
"\n",
111
110
"Next, we will be Python UDF function using the `@udf` annotation. We will be using the `VADER` model of `nltk` library to perform sentiment analysis on the review text."
112
-
]
111
+
],
112
+
"id": "9797abdb"
113
113
},
114
114
{
115
115
"cell_type": "code",
@@ -124,7 +124,6 @@
124
124
{
125
125
"cell_type": "code",
126
126
"execution_count": 4,
127
-
"id": "f3f3b047",
128
127
"metadata": {},
129
128
"outputs": [],
130
129
"source": [
@@ -146,29 +145,30 @@
146
145
" )\n",
147
146
" print(\"sentiment:\" + sentiment)\n",
148
147
" return sentiment"
149
-
]
148
+
],
149
+
"id": "37e6d3e9"
150
150
},
151
151
{
152
152
"attachments": {},
153
153
"cell_type": "markdown",
154
-
"id": "40e2ad59",
155
154
"metadata": {},
156
155
"source": [
157
156
"## Start the Python UDF server\n",
158
157
"\n",
159
158
"This will start the server as well as register all the functions annotated with `@udf` as external user defined functions on your selected database."
0 commit comments