Created
October 22, 2023 07:17
-
-
Save yssymmt/f17df3cf503a5af79d9eb628a974e859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"id": "def9466d-66b0-4eb3-a178-e5bd3a0350f3", | |
"metadata": {}, | |
"source": [ | |
"## 位置情報とパブリックデータ#04: <br>(地理空間関数)距離計算とストアドプロシージャ\n", | |
"###### 利用データはgeof_03geometry.ipynbと同じものを利用" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "155f2ee2-bc2c-4ec8-a106-ad067de8e4ff", | |
"metadata": {}, | |
"source": [ | |
"#### データベース接続" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"id": "4fcc1ee9-5407-4706-8b9b-0fde32a332c0", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"name": "stdin", | |
"output_type": "stream", | |
"text": [ | |
"Password: ········\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Success: 'jumbo' connection established and activated for user 'jumbo', with default database 'jumbo'\n" | |
] | |
} | |
], | |
"source": [ | |
"%connect jumbo" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "95f94d7f-b8f1-4988-8501-77d4eaa3b3cd", | |
"metadata": {}, | |
"source": [ | |
"#### st_distanceは()数学的な距離を返す。元がメートルなら出力の距離もメートル、度数なら度数" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "0ac8bfeb-32f9-48d8-b17c-5e27f49459cc", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"距離\"\n\"1.4142135623730951\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory562040\"><style>\n", | |
" table.tdhistory562040 { display: block !important; min-height: 105px !important; overflow: auto !important; height: 105px !important; width: 100% !important; border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory562040 { border: 1px solid rgb(198,198,198) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: center !important; white-space: normal !important; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory562040:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory562040 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory562040 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory562040 { border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: left !important; white-space: nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;; }\n", | |
" </style><thead><tr style= \"background: rgba(243, 243, 243, 0.75)\"><th class=\"tdhistory562040\"></th><th class=\"tdhistory562040\">距離</th></tr></thead><tbody class=\"tdhistory562040 resultset-body\"><tr><th class=\"tdhistory562040\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory562040\">1.4142135623730951</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.38.20.611_JST\",\"historyID\":49,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":1,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"距離\",\"columnTypeName\":\"FLOAT\"}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"cast('point(1 0)' as st_geometry).st_distance(cast('point(0 1)' as st_geometry)) as 距離 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "e1b8be44-9803-488b-bf77-cd6e031a7239", | |
"metadata": {}, | |
"source": [ | |
"#### 距離に基づく絞り込み、指定の位置から1000メートル(1km)以内" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "b81be43e-7dcc-4785-ba7c-cf0b0a824dee", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"番号\",\"名前\",\"距離\"\n\"1\",\"月島突端\",\"0\"\n\"0\",\"隅田川流心\",\"221.90588107249326\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory930743\"><style>\n", | |
" table.tdhistory930743 { display: block !important; min-height: 126px !important; overflow: auto !important; height: 126px !important; width: 100% !important; border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory930743 { border: 1px solid rgb(198,198,198) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: center !important; white-space: normal !important; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory930743:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory930743 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory930743 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory930743 { border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: left !important; white-space: nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;; }\n", | |
" </style><thead><tr style= \"background: rgba(243, 243, 243, 0.75)\"><th class=\"tdhistory930743\"></th><th class=\"tdhistory930743\">番号</th><th class=\"tdhistory930743\">名前</th><th class=\"tdhistory930743\">距離</th></tr></thead><tbody class=\"tdhistory930743 resultset-body\"><tr><th class=\"tdhistory930743\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory930743\">1</td><td class=\"tdhistory930743\">月島突端</td><td class=\"tdhistory930743\">0</td></tr><tr><th class=\"tdhistory930743\" style= \"background: rgba(243, 243, 243, 0.75)\">2</th><td class=\"tdhistory930743\">0</td><td class=\"tdhistory930743\">隅田川流心</td><td class=\"tdhistory930743\">221.90588107249326</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 3, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.39.03.479_JST\",\"historyID\":50,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":2,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"番号\",\"columnTypeName\":\"INTEGER\"},{\"columnNumber\":1,\"columnName\":\"名前\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":2,\"columnName\":\"距離\",\"columnTypeName\":\"FLOAT\"}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"番号, \n", | |
"名前, \n", | |
"cast('point(139.786257 35.671459)' as st_geometry).st_spheroidaldistance(lonlat) as 距離 \n", | |
"from jumbo.geoshape \n", | |
"where 番号 <=3 \n", | |
"and cast('point(139.786257 35.671459)' as st_geometry).st_spheroidaldistance(lonlat) <=1000 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "49b36256-83db-467a-8b46-89f12e5df4a8", | |
"metadata": {}, | |
"source": [ | |
"#### st_sphericaldistance()は地球を完全な球体とみなして計算\n", | |
"#### st_spheroidaldistance()はより地球の実体に近い回転楕円体とみなして計算 \n", | |
"#### 単位はst_distance()を除きメートル" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "9813ebed-4b18-4b94-a5e9-4b597d9933c3", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"名前左\",\"名前右\",\"距離_平面\",\"距離_完全球体\",\"距離_楕円球体\",\"メートル差\"\n\"隅田川流心\",\"ハウステンボス\",\"10.323026691727298\",\"960638.8235811854\",\"962349.3211783984\",\"-1710.4975972130196\"\n\"隅田川流心\",\"月島突端\",\"0.0020000000000024443\",\"222.38985328938924\",\"221.90588107249326\",\"0.48397221689597814\"\n\"隅田川流心\",\"かすみがうら\",\"0.7619512547729056\",\"75545.93182159179\",\"75548.49801554848\",\"-2.5661939566925867\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory378375\"><style>\n", | |
" table.tdhistory378375 { display: block !important; min-height: 147px !important; overflow: auto !important; height: 147px !important; width: 100% !important; border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory378375 { border: 1px solid rgb(198,198,198) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: center !important; white-space: normal !important; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory378375:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory378375 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory378375 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory378375 { border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: left !important; white-space: nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;; }\n", | |
" </style><thead><tr style= \"background: rgba(243, 243, 243, 0.75)\"><th class=\"tdhistory378375\"></th><th class=\"tdhistory378375\">名前左</th><th class=\"tdhistory378375\">名前右</th><th class=\"tdhistory378375\">距離_平面</th><th class=\"tdhistory378375\">距離_完全球体</th><th class=\"tdhistory378375\">距離_楕円球体</th><th class=\"tdhistory378375\">メートル差</th></tr></thead><tbody class=\"tdhistory378375 resultset-body\"><tr><th class=\"tdhistory378375\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory378375\">隅田川流心</td><td class=\"tdhistory378375\">ハウステンボス</td><td class=\"tdhistory378375\">10.323026691727298</td><td class=\"tdhistory378375\">960638.8235811854</td><td class=\"tdhistory378375\">962349.3211783984</td><td class=\"tdhistory378375\">-1710.4975972130196</td></tr><tr><th class=\"tdhistory378375\" style= \"background: rgba(243, 243, 243, 0.75)\">2</th><td class=\"tdhistory378375\">隅田川流心</td><td class=\"tdhistory378375\">月島突端</td><td class=\"tdhistory378375\">0.0020000000000024443</td><td class=\"tdhistory378375\">222.38985328938924</td><td class=\"tdhistory378375\">221.90588107249326</td><td class=\"tdhistory378375\">0.48397221689597814</td></tr><tr><th class=\"tdhistory378375\" style= \"background: rgba(243, 243, 243, 0.75)\">3</th><td class=\"tdhistory378375\">隅田川流心</td><td class=\"tdhistory378375\">かすみがうら</td><td class=\"tdhistory378375\">0.7619512547729056</td><td class=\"tdhistory378375\">75545.93182159179</td><td class=\"tdhistory378375\">75548.49801554848</td><td class=\"tdhistory378375\">-2.5661939566925867</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.40.02.568_JST\",\"historyID\":51,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":3,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"名前左\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":1,\"columnName\":\"名前右\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":2,\"columnName\":\"距離_平面\",\"columnTypeName\":\"FLOAT\"},{\"columnNumber\":3,\"columnName\":\"距離_完全球体\",\"columnTypeName\":\"FLOAT\"},{\"columnNumber\":4,\"columnName\":\"距離_楕円球体\",\"columnTypeName\":\"FLOAT\"},{\"columnNumber\":5,\"columnName\":\"メートル差\",\"columnTypeName\":\"FLOAT\"}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"名前左, \n", | |
"名前右, \n", | |
"lonlat左.st_distance(lonlat右) as 距離_平面, \n", | |
"lonlat左.st_sphericaldistance(lonlat右) as 距離_完全球体, \n", | |
"lonlat左.st_spheroidaldistance(lonlat右) as 距離_楕円球体, \n", | |
"距離_完全球体 - 距離_楕円球体 as メートル差 \n", | |
"from ( \n", | |
"\tselect \n", | |
"\t名前 as 名前左, \n", | |
"\tlonlat as lonlat左 \n", | |
"\tfrom jumbo.geoshape \n", | |
"\twhere 番号=0 \n", | |
") a1 cross join ( \n", | |
"\tselect \n", | |
"\t名前 as 名前右, \n", | |
"\tlonlat as lonlat右 \n", | |
"\tfrom jumbo.geoshape \n", | |
"\twhere 番号 between 1 and 3 \n", | |
") a2 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "a46984e6-eb8a-4648-a6a5-f4226eb7f1f3", | |
"metadata": {}, | |
"source": [ | |
"### 最寄り駅、最寄り店舗を顧客ごとに特定する処理をストアドプロシージャで" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "1a370183-9f8e-45c3-9962-b2c2b761cd50", | |
"metadata": {}, | |
"source": [ | |
"#### お掃除" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "c4920323-7273-489e-a02a-b5a6fccbede1", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"ename": "ERROR", | |
"evalue": "Unable to run SQL: Unable to run SQL query: Database reported error:5495:Stored Procedure 'jumbo.geonearest_sp' does not exist.", | |
"output_type": "error", | |
"traceback": [ | |
"Unable to run SQL: Unable to run SQL query: Database reported error:5495:Stored Procedure 'jumbo.geonearest_sp' does not exist." | |
] | |
} | |
], | |
"source": [ | |
"drop procedure jumbo.geonearest_sp; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "cbbf6fe9-befd-4e6c-94c2-507680ac3149", | |
"metadata": {}, | |
"source": [ | |
"#### もう一つお掃除" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "52c69d93-140c-4392-85ee-a8926328d81d", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"ename": "ERROR", | |
"evalue": "Unable to run SQL: Unable to run SQL query: Database reported error:3807:Object 'jumbo.geonearest_result' does not exist.", | |
"output_type": "error", | |
"traceback": [ | |
"Unable to run SQL: Unable to run SQL query: Database reported error:3807:Object 'jumbo.geonearest_result' does not exist." | |
] | |
} | |
], | |
"source": [ | |
"drop table jumbo.geonearest_result; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "192a728b-9261-43b3-936f-a366e48f792f", | |
"metadata": {}, | |
"source": [ | |
"#### 結果格納用テーブルの作成" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "4207916b-99a8-45de-82ba-f0051d983eb8", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 0 rows affected" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"create table jumbo.geonearest_result ( \n", | |
"番号 integer, \n", | |
"名前_顧客 varchar(10) character set unicode, \n", | |
"名前_店舗 varchar(10) character set unicode, \n", | |
"距離 float \n", | |
") primary index (番号) \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "ee18b944-d0c5-478e-b47b-045744c5a874", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"#### 権限を付与する必要がある場合(dbcユーザーなど管理者権限で実行する): onはオブジェクト、toはユーザー" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "b4de699d-8564-42e8-a278-5157a0f0a8b7", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"grant create procedure on jumbo to jumbo; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "d90dc815-5bba-4db5-8979-5a569a5c6acd", | |
"metadata": {}, | |
"source": [ | |
"#### ストアドプロシージャの登録 \n", | |
"###### すべての店舗からの距離を計算し、その後最も小さいものにrn=1をセットして絞り込み \n", | |
"###### 一括処理ではなく、1件ずつ逐次処理を実行する " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "ca3eec45-1233-4946-9517-c5256bee133d", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 0 rows affected" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"replace procedure jumbo.geonearest_sp ( \n", | |
"\tin sttnum integer, \n", | |
"\tin endnum integer \n", | |
") \n", | |
"lmain: begin \n", | |
"\tdeclare hnum integer; \n", | |
"\tset hnum=sttnum; \n", | |
"\twhile (hnum <= endnum) \n", | |
"\tdo \n", | |
"\t\tinsert into jumbo.geonearest_result \n", | |
"\t\tselect \n", | |
"\t\t番号, \n", | |
"\t\t名前_顧客, \n", | |
"\t\t名前_店舗, \n", | |
"\t\tlonlat左.st_spheroidaldistance(lonlat右) as 距離 \n", | |
"\t\tfrom ( \n", | |
"\t\t\tselect \n", | |
"\t\t\t名前 as 名前_店舗, \n", | |
"\t\t\tlonlat as lonlat左 \n", | |
"\t\t\tfrom jumbo.geoshape \n", | |
"\t\t\twhere 番号 in (0,1) \n", | |
"\t\t) a1 cross join ( \n", | |
"\t\t\tselect \n", | |
"\t\t\t番号, \n", | |
"\t\t\t名前 as 名前_顧客, \n", | |
"\t\t\tlonlat as lonlat右 \n", | |
"\t\t\tfrom jumbo.geoshape \n", | |
"\t\t\twhere 番号 =hnum \n", | |
"\t\t) a2 \n", | |
"\t\tqualify row_number() over(partition by 番号 order by 距離,名前_店舗) =1 \n", | |
"\t\t; \n", | |
"\t\tset hnum = hnum+1; \n", | |
"\tend while; \n", | |
"end lmain; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "33d123ff-227c-43c2-b806-682caa122d12", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"#### ストアドプロシージャの実行、0番1番を除外して実行" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "015e203c-4a98-406c-b1d7-f2d88ce57fe3", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 0 rows affected" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"call jumbo.geonearest_sp (2,3); " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "28c71f87-7f12-487e-b58e-f889fc89050d", | |
"metadata": {}, | |
"source": [ | |
"#### 結果の確認" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 13, | |
"id": "428bc07d-f130-40c9-b448-0185705fb669", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"番号\",\"名前_顧客\",\"名前_店舗\",\"距離\"\n\"2\",\"かすみがうら\",\"隅田川流心\",\"75548.49801554848\"\n\"3\",\"ハウステンボス\",\"月島突端\",\"962293.9002273261\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory526708\"><style>\n", | |
" table.tdhistory526708 { display: block !important; min-height: 126px !important; overflow: auto !important; height: 126px !important; width: 100% !important; border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory526708 { border: 1px solid rgb(198,198,198) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: center !important; white-space: normal !important; color: var(--jp-ui-font-color1) !important; }\n", | |
" th.tdhistory526708:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory526708 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory526708 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory526708 { border: 1px solid rgb(207, 207, 207) !important; border-collapse: collapse !important; ; padding: 2px 5px !important; ; font-size: 13px !important; ; text-align: left !important; white-space: nowrap !important; overflow:hidden !important; text-overflow:ellipsis !important;; }\n", | |
" </style><thead><tr style= \"background: rgba(243, 243, 243, 0.75)\"><th class=\"tdhistory526708\"></th><th class=\"tdhistory526708\">番号</th><th class=\"tdhistory526708\">名前_顧客</th><th class=\"tdhistory526708\">名前_店舗</th><th class=\"tdhistory526708\">距離</th></tr></thead><tbody class=\"tdhistory526708 resultset-body\"><tr><th class=\"tdhistory526708\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory526708\">2</td><td class=\"tdhistory526708\">かすみがうら</td><td class=\"tdhistory526708\">隅田川流心</td><td class=\"tdhistory526708\">75548.49801554848</td></tr><tr><th class=\"tdhistory526708\" style= \"background: rgba(243, 243, 243, 0.75)\">2</th><td class=\"tdhistory526708\">3</td><td class=\"tdhistory526708\">ハウステンボス</td><td class=\"tdhistory526708\">月島突端</td><td class=\"tdhistory526708\">962293.9002273261</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 13, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.47.06.748_JST\",\"historyID\":60,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":2,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"番号\",\"columnTypeName\":\"INTEGER\"},{\"columnNumber\":1,\"columnName\":\"名前_顧客\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":2,\"columnName\":\"名前_店舗\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":3,\"columnName\":\"距離\",\"columnTypeName\":\"FLOAT\"}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select * from jumbo.geonearest_result order by 1; " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "0ea4a9ec-df47-4129-961f-23aa74346a15", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Teradata SQL", | |
"language": "Teradata SQL", | |
"name": "teradatasql" | |
}, | |
"language_info": { | |
"codemirror_mode": "Teradata SQL", | |
"file_extension": ".tdrs", | |
"mimetype": "application/vnd.teradata.resultset", | |
"name": "Teradata SQL", | |
"nbconvert_exporter": "", | |
"pygments_lexer": "", | |
"version": "16.20" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment