Skip to content

Commit 0a407ca

Browse files
authored
Merge pull request #15 from codefuse-ai/commit-tuto-outputs
[doc] Commit and improve tutorials outputs
2 parents 61ca129 + 1b9aca7 commit 0a407ca

File tree

5 files changed

+768
-2215
lines changed

5 files changed

+768
-2215
lines changed

tutorial/notebook/go_analysis.ipynb

Lines changed: 208 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,20 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": null,
21+
"execution_count": 1,
2222
"metadata": {
2323
"collapsed": false
2424
},
25-
"outputs": [],
25+
"outputs": [
26+
{
27+
"name": "stdout",
28+
"output_type": "stream",
29+
"text": [
30+
"/sparrow-cli/sparrow\n",
31+
"\n"
32+
]
33+
}
34+
],
2635
"source": [
2736
"!which sparrow"
2837
]
@@ -38,7 +47,7 @@
3847
},
3948
{
4049
"cell_type": "code",
41-
"execution_count": null,
50+
"execution_count": 2,
4251
"metadata": {
4352
"ExecuteTime": {
4453
"end_time": "2023-11-22T08:30:58.387715Z",
@@ -47,7 +56,7 @@
4756
},
4857
"outputs": [],
4958
"source": [
50-
"!git clone https://github.com/go-gorm/gorm.git"
59+
"!git clone https://github.com/go-gorm/gorm.git -q"
5160
]
5261
},
5362
{
@@ -59,7 +68,7 @@
5968
},
6069
{
6170
"cell_type": "code",
62-
"execution_count": null,
71+
"execution_count": 7,
6372
"metadata": {
6473
"ExecuteTime": {
6574
"end_time": "2023-11-23T03:46:32.220317Z",
@@ -68,7 +77,7 @@
6877
},
6978
"outputs": [],
7079
"source": [
71-
"!sparrow database create --source-root gorm --data-language-type go --output ./db/gorm"
80+
"!sparrow database create --source-root gorm --data-language-type go --output ./db/gorm --overwrite > /dev/null"
7281
]
7382
},
7483
{
@@ -91,9 +100,169 @@
91100
},
92101
{
93102
"cell_type": "code",
94-
"execution_count": null,
103+
"execution_count": 4,
95104
"metadata": {},
96-
"outputs": [],
105+
"outputs": [
106+
{
107+
"name": "stdout",
108+
"output_type": "stream",
109+
"text": [
110+
"/workspaces/CodeFuse-Query/tutorial/notebook/db/gorm\n"
111+
]
112+
},
113+
{
114+
"name": "stderr",
115+
"output_type": "stream",
116+
"text": [
117+
"\u001b[0;31mSparrow database is set to: /workspaces/CodeFuse-Query/tutorial/notebook/db/gorm\n",
118+
"\u001b[0m"
119+
]
120+
},
121+
{
122+
"name": "stdout",
123+
"output_type": "stream",
124+
"text": [
125+
"2023-12-06 07:42:29,249 INFO: sparrow 2.0.0\n",
126+
" will start\n",
127+
"2023-12-06 07:42:29,249 INFO: database /workspaces/CodeFuse-Query/tutorial/notebook/db/gorm/coref_go_src.db size: 42.32 MB\n",
128+
"2023-12-06 07:42:29,250 INFO: execute : /sparrow-cli/godel-script/usr/bin/godel /tmp/godel-jupyter-t7lsy12n/query.gdl -p /sparrow-cli/lib-1.0 -o /tmp/tmphp2bm3pi.gdl\n",
129+
"2023-12-06 07:42:29,314 INFO: godel-script compile time: 0.06s\n",
130+
"2023-12-06 07:42:29,315 INFO: execute : /sparrow-cli/godel-1.0/usr/bin/godel /tmp/tmphp2bm3pi.gdl --run-souffle-directly --package-path /sparrow-cli/lib-1.0 --souffle-fact-dir /workspaces/CodeFuse-Query/tutorial/notebook/db/gorm --souffle-output-format json --souffle-output-path /tmp/godel-jupyter-t7lsy12n/query.json\n",
131+
"2023-12-06 07:42:39,655 INFO: Task /tmp/godel-jupyter-t7lsy12n/query.gdl is success, result is NOT-EMPTY, execution time is 10.41s.\n",
132+
"2023-12-06 07:42:39,656 INFO: run success\n",
133+
"\n",
134+
"Total results: 942\n"
135+
]
136+
},
137+
{
138+
"data": {
139+
"text/html": [
140+
"<div>\n",
141+
"<style scoped>\n",
142+
" .dataframe tbody tr th:only-of-type {\n",
143+
" vertical-align: middle;\n",
144+
" }\n",
145+
"\n",
146+
" .dataframe tbody tr th {\n",
147+
" vertical-align: top;\n",
148+
" }\n",
149+
"\n",
150+
" .dataframe thead th {\n",
151+
" text-align: right;\n",
152+
" }\n",
153+
"</style>\n",
154+
"<table border=\"1\" class=\"dataframe\">\n",
155+
" <thead>\n",
156+
" <tr style=\"text-align: right;\">\n",
157+
" <th></th>\n",
158+
" <th>name</th>\n",
159+
" <th>func</th>\n",
160+
" <th>cmplx</th>\n",
161+
" <th>sl</th>\n",
162+
" <th>el</th>\n",
163+
" </tr>\n",
164+
" </thead>\n",
165+
" <tbody>\n",
166+
" <tr>\n",
167+
" <th>0</th>\n",
168+
" <td>association.go</td>\n",
169+
" <td>Delete</td>\n",
170+
" <td>20</td>\n",
171+
" <td>197</td>\n",
172+
" <td>361</td>\n",
173+
" </tr>\n",
174+
" <tr>\n",
175+
" <th>1</th>\n",
176+
" <td>association.go</td>\n",
177+
" <td>Unscoped</td>\n",
178+
" <td>1</td>\n",
179+
" <td>44</td>\n",
180+
" <td>51</td>\n",
181+
" </tr>\n",
182+
" <tr>\n",
183+
" <th>2</th>\n",
184+
" <td>association.go</td>\n",
185+
" <td>Find</td>\n",
186+
" <td>2</td>\n",
187+
" <td>53</td>\n",
188+
" <td>58</td>\n",
189+
" </tr>\n",
190+
" <tr>\n",
191+
" <th>3</th>\n",
192+
" <td>association.go</td>\n",
193+
" <td>Association</td>\n",
194+
" <td>4</td>\n",
195+
" <td>21</td>\n",
196+
" <td>42</td>\n",
197+
" </tr>\n",
198+
" <tr>\n",
199+
" <th>4</th>\n",
200+
" <td>association.go</td>\n",
201+
" <td>Count</td>\n",
202+
" <td>2</td>\n",
203+
" <td>367</td>\n",
204+
" <td>372</td>\n",
205+
" </tr>\n",
206+
" <tr>\n",
207+
" <th>...</th>\n",
208+
" <td>...</td>\n",
209+
" <td>...</td>\n",
210+
" <td>...</td>\n",
211+
" <td>...</td>\n",
212+
" <td>...</td>\n",
213+
" </tr>\n",
214+
" <tr>\n",
215+
" <th>937</th>\n",
216+
" <td>tests/preload_test.go</td>\n",
217+
" <td>TestPreloadEmptyData</td>\n",
218+
" <td>5</td>\n",
219+
" <td>215</td>\n",
220+
" <td>235</td>\n",
221+
" </tr>\n",
222+
" <tr>\n",
223+
" <th>938</th>\n",
224+
" <td>tests/preload_test.go</td>\n",
225+
" <td>TestPreloadGoroutine</td>\n",
226+
" <td>2</td>\n",
227+
" <td>237</td>\n",
228+
" <td>253</td>\n",
229+
" </tr>\n",
230+
" <tr>\n",
231+
" <th>939</th>\n",
232+
" <td>tests/preload_test.go</td>\n",
233+
" <td>TestPreloadWithDiffModel</td>\n",
234+
" <td>2</td>\n",
235+
" <td>255</td>\n",
236+
" <td>271</td>\n",
237+
" </tr>\n",
238+
" <tr>\n",
239+
" <th>940</th>\n",
240+
" <td>tests/preload_test.go</td>\n",
241+
" <td>TestNestedPreloadWithUnscoped</td>\n",
242+
" <td>4</td>\n",
243+
" <td>273</td>\n",
244+
" <td>308</td>\n",
245+
" </tr>\n",
246+
" <tr>\n",
247+
" <th>941</th>\n",
248+
" <td>tests/preload_test.go</td>\n",
249+
" <td>TestEmbedPreload</td>\n",
250+
" <td>2</td>\n",
251+
" <td>310</td>\n",
252+
" <td>445</td>\n",
253+
" </tr>\n",
254+
" </tbody>\n",
255+
"</table>\n",
256+
"</div>"
257+
],
258+
"text/plain": [
259+
"<IPython.core.display.HTML object>"
260+
]
261+
},
262+
"metadata": {},
263+
"output_type": "display_data"
264+
}
265+
],
97266
"source": [
98267
"%db ./db/gorm\n",
99268
"// script\n",
@@ -137,9 +306,17 @@
137306
},
138307
{
139308
"cell_type": "code",
140-
"execution_count": null,
309+
"execution_count": 5,
141310
"metadata": {},
142-
"outputs": [],
311+
"outputs": [
312+
{
313+
"name": "stdout",
314+
"output_type": "stream",
315+
"text": [
316+
"Query result saved to /workspaces/CodeFuse-Query/tutorial/notebook/query.json\n"
317+
]
318+
}
319+
],
143320
"source": [
144321
"%%save_to ./query.json"
145322
]
@@ -155,15 +332,33 @@
155332
},
156333
{
157334
"cell_type": "code",
158-
"execution_count": null,
335+
"execution_count": 6,
159336
"metadata": {
160337
"ExecuteTime": {
161338
"end_time": "2023-11-23T03:54:56.998681Z",
162339
"start_time": "2023-11-23T03:54:56.976694Z"
163340
},
164341
"collapsed": false
165342
},
166-
"outputs": [],
343+
"outputs": [
344+
{
345+
"name": "stdout",
346+
"output_type": "stream",
347+
"text": [
348+
" name func cmplx sl el\n",
349+
"428 schema/field.go ParseField 110 99 436\n",
350+
"18 callbacks/update.go ConvertToAssignments 69 131 304\n",
351+
"309 schema/schema.go ParseWithSpecialTableName 68 121 370\n",
352+
"130 callbacks/create.go ConvertToCreateValues 64 217 385\n",
353+
"234 scan.go Scan 62 125 342\n",
354+
"30 statement.go BuildCondition 61 284 465\n",
355+
"429 schema/field.go setupValuerAndSetter 46 439 969\n",
356+
"729 tests/migrate_test.go TestMigrateColumns 44 517 645\n",
357+
"11 callbacks/query.go BuildQuerySQL 41 33 266\n",
358+
"281 migrator/migrator.go MigrateColumn 41 441 542\n"
359+
]
360+
}
361+
],
167362
"source": [
168363
"%%python\n",
169364
"import pandas as pd\n",
@@ -199,7 +394,7 @@
199394
],
200395
"mimetype": "text/rust",
201396
"name": "rust",
202-
"version": "0.0.3"
397+
"version": "0.0.4"
203398
}
204399
},
205400
"nbformat": 4,

0 commit comments

Comments
 (0)