Skip to content

[doc] Commit and improve tutorials outputs #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 208 additions & 13 deletions tutorial/notebook/go_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,20 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/sparrow-cli/sparrow\n",
"\n"
]
}
],
"source": [
"!which sparrow"
]
Expand All @@ -38,7 +47,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-22T08:30:58.387715Z",
Expand All @@ -47,7 +56,7 @@
},
"outputs": [],
"source": [
"!git clone https://github.com/go-gorm/gorm.git"
"!git clone https://github.com/go-gorm/gorm.git -q"
]
},
{
Expand All @@ -59,7 +68,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-23T03:46:32.220317Z",
Expand All @@ -68,7 +77,7 @@
},
"outputs": [],
"source": [
"!sparrow database create --source-root gorm --data-language-type go --output ./db/gorm"
"!sparrow database create --source-root gorm --data-language-type go --output ./db/gorm --overwrite > /dev/null"
]
},
{
Expand All @@ -91,9 +100,169 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/workspaces/CodeFuse-Query/tutorial/notebook/db/gorm\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\u001b[0;31mSparrow database is set to: /workspaces/CodeFuse-Query/tutorial/notebook/db/gorm\n",
"\u001b[0m"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"2023-12-06 07:42:29,249 INFO: sparrow 2.0.0\n",
" will start\n",
"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",
"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",
"2023-12-06 07:42:29,314 INFO: godel-script compile time: 0.06s\n",
"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",
"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",
"2023-12-06 07:42:39,656 INFO: run success\n",
"\n",
"Total results: 942\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>func</th>\n",
" <th>cmplx</th>\n",
" <th>sl</th>\n",
" <th>el</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>association.go</td>\n",
" <td>Delete</td>\n",
" <td>20</td>\n",
" <td>197</td>\n",
" <td>361</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>association.go</td>\n",
" <td>Unscoped</td>\n",
" <td>1</td>\n",
" <td>44</td>\n",
" <td>51</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>association.go</td>\n",
" <td>Find</td>\n",
" <td>2</td>\n",
" <td>53</td>\n",
" <td>58</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>association.go</td>\n",
" <td>Association</td>\n",
" <td>4</td>\n",
" <td>21</td>\n",
" <td>42</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>association.go</td>\n",
" <td>Count</td>\n",
" <td>2</td>\n",
" <td>367</td>\n",
" <td>372</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>937</th>\n",
" <td>tests/preload_test.go</td>\n",
" <td>TestPreloadEmptyData</td>\n",
" <td>5</td>\n",
" <td>215</td>\n",
" <td>235</td>\n",
" </tr>\n",
" <tr>\n",
" <th>938</th>\n",
" <td>tests/preload_test.go</td>\n",
" <td>TestPreloadGoroutine</td>\n",
" <td>2</td>\n",
" <td>237</td>\n",
" <td>253</td>\n",
" </tr>\n",
" <tr>\n",
" <th>939</th>\n",
" <td>tests/preload_test.go</td>\n",
" <td>TestPreloadWithDiffModel</td>\n",
" <td>2</td>\n",
" <td>255</td>\n",
" <td>271</td>\n",
" </tr>\n",
" <tr>\n",
" <th>940</th>\n",
" <td>tests/preload_test.go</td>\n",
" <td>TestNestedPreloadWithUnscoped</td>\n",
" <td>4</td>\n",
" <td>273</td>\n",
" <td>308</td>\n",
" </tr>\n",
" <tr>\n",
" <th>941</th>\n",
" <td>tests/preload_test.go</td>\n",
" <td>TestEmbedPreload</td>\n",
" <td>2</td>\n",
" <td>310</td>\n",
" <td>445</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%db ./db/gorm\n",
"// script\n",
Expand Down Expand Up @@ -137,9 +306,17 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Query result saved to /workspaces/CodeFuse-Query/tutorial/notebook/query.json\n"
]
}
],
"source": [
"%%save_to ./query.json"
]
Expand All @@ -155,15 +332,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"ExecuteTime": {
"end_time": "2023-11-23T03:54:56.998681Z",
"start_time": "2023-11-23T03:54:56.976694Z"
},
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" name func cmplx sl el\n",
"428 schema/field.go ParseField 110 99 436\n",
"18 callbacks/update.go ConvertToAssignments 69 131 304\n",
"309 schema/schema.go ParseWithSpecialTableName 68 121 370\n",
"130 callbacks/create.go ConvertToCreateValues 64 217 385\n",
"234 scan.go Scan 62 125 342\n",
"30 statement.go BuildCondition 61 284 465\n",
"429 schema/field.go setupValuerAndSetter 46 439 969\n",
"729 tests/migrate_test.go TestMigrateColumns 44 517 645\n",
"11 callbacks/query.go BuildQuerySQL 41 33 266\n",
"281 migrator/migrator.go MigrateColumn 41 441 542\n"
]
}
],
"source": [
"%%python\n",
"import pandas as pd\n",
Expand Down Expand Up @@ -199,7 +394,7 @@
],
"mimetype": "text/rust",
"name": "rust",
"version": "0.0.3"
"version": "0.0.4"
}
},
"nbformat": 4,
Expand Down
Loading