Created
October 22, 2023 07:17
-
-
Save yssymmt/c52b14e1e54b229ef76d659ade039afa 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": "67be9ea1-fa75-4127-ba40-9ca230776893", | |
"metadata": {}, | |
"source": [ | |
"## 位置情報とパブリックデータ#03: <br>Teradataの地理空間データ型" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "5a2c2eb9-215e-4fd2-9a6f-f56da81fc730", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"#### データベース接続" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "5786c3bc-af5e-4aef-9fbc-2ff064993a64", | |
"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": "5d223c25-22e5-4f1d-9563-5bc2750f68f5", | |
"metadata": {}, | |
"source": [ | |
"#### 事前のお掃除" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "d964875e-80e8-40b6-a668-eaa3587ad8f1", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"ename": "ERROR", | |
"evalue": "Unable to run SQL: Unable to run SQL query: Database reported error:3807:Object 'jumbo.geoshape' does not exist.", | |
"output_type": "error", | |
"traceback": [ | |
"Unable to run SQL: Unable to run SQL query: Database reported error:3807:Object 'jumbo.geoshape' does not exist." | |
] | |
} | |
], | |
"source": [ | |
"drop table jumbo.geoshape; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "7c122083-8533-4c31-abb5-f9d031347c45", | |
"metadata": {}, | |
"source": [ | |
"#### 空テーブル作成" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "c95aec3b-0117-4dd3-b666-61b9edd304b4", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 0 rows affected" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"create table jumbo.geoshape ( \n", | |
"番号 integer, \n", | |
"名前 varchar(10) character set unicode, \n", | |
"lonlat st_geometry \n", | |
") primary index (番号) \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "4c74ab20-832b-4b14-a7c4-f523d36e87c3", | |
"metadata": {}, | |
"source": [ | |
"#### データの挿入" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 6, | |
"id": "4ad010ac-5f09-4758-b286-7ac5389bc56e", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 6, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"insert into jumbo.geoshape values ('1','月島突端','point(139.786257 35.671459)'); \n", | |
"insert into jumbo.geoshape values ('2','かすみがうら','point(140.374286 36.158012)'); \n", | |
"insert into jumbo.geoshape values ('3','ハウステンボス','point(129.792622 33.086542)'); \n", | |
"insert into jumbo.geoshape values ('4','折れ線','linestring(139.264731 39.087856,139.264731 35.057423,135.397544 35.057423)'); \n", | |
"insert into jumbo.geoshape values ('5','ポリゴン1','polygon((132 35.5,134 35.5,134 33.5,132 33.5,132 35.5))'); \n", | |
"insert into jumbo.geoshape values ('6','ポリゴン2','polygon((133 34.5,135 34.5,135 32.5,133 32.5,133 34.5))'); " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "502229c6-a65a-435c-ac9a-c5e6da013a89", | |
"metadata": {}, | |
"source": [ | |
"#### データ型を確認してみる" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 7, | |
"id": "2b842c33-8253-451c-8894-f156f4821e68", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"データ型_番号\",\"データ型_名前\",\"データ型_lonlat\"\n\"INTEGER \",\"VARCHAR(10) CHARACTER SET UNICODE \",\"SYSUDTLIB.ST_GEOMETRY \"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory947168\"><style>\n", | |
" table.tdhistory947168 { 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.tdhistory947168 { 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.tdhistory947168:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory947168 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory947168 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory947168 { 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=\"tdhistory947168\"></th><th class=\"tdhistory947168\">データ型_番号</th><th class=\"tdhistory947168\">データ型_名前</th><th class=\"tdhistory947168\">データ型_lonlat</th></tr></thead><tbody class=\"tdhistory947168 resultset-body\"><tr><th class=\"tdhistory947168\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory947168\">INTEGER </td><td class=\"tdhistory947168\">VARCHAR(10) CHARACTER SET UNICODE </td><td class=\"tdhistory947168\">SYSUDTLIB.ST_GEOMETRY </td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 7, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.21.50.729_JST\",\"historyID\":43,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":1,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"データ型_番号\",\"columnTypeName\":\"CHAR\",\"length\":7,\"scale\":7},{\"columnNumber\":1,\"columnName\":\"データ型_名前\",\"columnTypeName\":\"CHAR\",\"length\":33,\"scale\":33},{\"columnNumber\":2,\"columnName\":\"データ型_lonlat\",\"columnTypeName\":\"CHAR\",\"length\":21,\"scale\":21}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"type(番号) as データ型_番号, \n", | |
"type(名前) as データ型_名前, \n", | |
"type(lonlat) as データ型_lonlat \n", | |
"from jumbo.geoshape \n", | |
"group by 1,2,3 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "2cfac181-313e-4044-8c70-5973ad3ddf0d", | |
"metadata": { | |
"tags": [] | |
}, | |
"source": [ | |
"#### 実際のデータを見る、文字型にキャストしてから" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 9, | |
"id": "08b27050-f023-4ecb-8f91-f3e93b407f65", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"番号\",\"名前\",\"lonlat\"\n\"1\",\"月島突端\",\"POINT (139.786257 35.671459)\"\n\"2\",\"かすみがうら\",\"POINT (140.374286 36.158012)\"\n\"3\",\"ハウステンボス\",\"POINT (129.792622 33.086542)\"\n\"4\",\"折れ線\",\"LINESTRING (139.264731 39.087856,139.264731 35.057423,135.397544 35.057423)\"\n\"5\",\"ポリゴン1\",\"POLYGON ((132.0 35.5,134.0 35.5,134.0 33.5,132.0 33.5,132.0 35.5))\"\n\"6\",\"ポリゴン2\",\"POLYGON ((133.0 34.5,135.0 34.5,135.0 32.5,133.0 32.5,133.0 34.5))\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory100831\"><style>\n", | |
" table.tdhistory100831 { display: block !important; min-height: 210px !important; overflow: auto !important; height: 210px !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.tdhistory100831 { 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.tdhistory100831:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory100831 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory100831 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory100831 { 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=\"tdhistory100831\"></th><th class=\"tdhistory100831\">番号</th><th class=\"tdhistory100831\">名前</th><th class=\"tdhistory100831\">lonlat</th></tr></thead><tbody class=\"tdhistory100831 resultset-body\"><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory100831\">1</td><td class=\"tdhistory100831\">月島突端</td><td class=\"tdhistory100831\">POINT (139.786257 35.671459)</td></tr><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">2</th><td class=\"tdhistory100831\">2</td><td class=\"tdhistory100831\">かすみがうら</td><td class=\"tdhistory100831\">POINT (140.374286 36.158012)</td></tr><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">3</th><td class=\"tdhistory100831\">3</td><td class=\"tdhistory100831\">ハウステンボス</td><td class=\"tdhistory100831\">POINT (129.792622 33.086542)</td></tr><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">4</th><td class=\"tdhistory100831\">4</td><td class=\"tdhistory100831\">折れ線</td><td class=\"tdhistory100831\">LINESTRING (139.264731 39.087856,139.264731 35.057423,135.397544 35.057423)</td></tr><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">5</th><td class=\"tdhistory100831\">5</td><td class=\"tdhistory100831\">ポリゴン1</td><td class=\"tdhistory100831\">POLYGON ((132.0 35.5,134.0 35.5,134.0 33.5,132.0 33.5,132.0 35.5))</td></tr><tr><th class=\"tdhistory100831\" style= \"background: rgba(243, 243, 243, 0.75)\">6</th><td class=\"tdhistory100831\">6</td><td class=\"tdhistory100831\">ポリゴン2</td><td class=\"tdhistory100831\">POLYGON ((133.0 34.5,135.0 34.5,135.0 32.5,133.0 32.5,133.0 34.5))</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 9, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.22.32.152_JST\",\"historyID\":45,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":6,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"番号\",\"columnTypeName\":\"INTEGER\"},{\"columnNumber\":1,\"columnName\":\"名前\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":2,\"columnName\":\"lonlat\",\"columnTypeName\":\"VARCHAR\",\"length\":500,\"scale\":500}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"番号, \n", | |
"名前, \n", | |
"cast(lonlat as varchar(500)) as lonlat \n", | |
"from jumbo.geoshape \n", | |
"order by 1 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "2e197b03-a8bd-429e-b259-26f2c16a383e", | |
"metadata": {}, | |
"source": [ | |
"#### ポイントデータにおける座標データの取得関数\n", | |
"###### st_x()およびst_y()は座標データを抽出する。小数型 " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 10, | |
"id": "994a15d1-54e7-4293-86bc-da0a45afd9dc", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"番号\",\"名前\",\"経度\",\"緯度\"\n\"1\",\"月島突端\",\"139.786257\",\"35.671459\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory698131\"><style>\n", | |
" table.tdhistory698131 { 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.tdhistory698131 { 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.tdhistory698131:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory698131 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory698131 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory698131 { 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=\"tdhistory698131\"></th><th class=\"tdhistory698131\">番号</th><th class=\"tdhistory698131\">名前</th><th class=\"tdhistory698131\">経度</th><th class=\"tdhistory698131\">緯度</th></tr></thead><tbody class=\"tdhistory698131 resultset-body\"><tr><th class=\"tdhistory698131\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory698131\">1</td><td class=\"tdhistory698131\">月島突端</td><td class=\"tdhistory698131\">139.786257</td><td class=\"tdhistory698131\">35.671459</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 10, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.23.38.362_JST\",\"historyID\":46,\"chunkID\":\"00001\",\"sessionid\":\"\",\"portnum\":\"\",\"dockermode\":\"standalone\",\"totalRowCount\":1,\"chunkCount\":0,\"rowLimit\":0,\"columnMetadata\":[{\"columnName\":\"番号\",\"columnTypeName\":\"INTEGER\"},{\"columnNumber\":1,\"columnName\":\"名前\",\"columnTypeName\":\"VARCHAR\",\"length\":10,\"scale\":10},{\"columnNumber\":2,\"columnName\":\"経度\",\"columnTypeName\":\"FLOAT\"},{\"columnNumber\":3,\"columnName\":\"緯度\",\"columnTypeName\":\"FLOAT\"}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"番号, \n", | |
"名前, \n", | |
"lonlat.st_x() as 経度, \n", | |
"lonlat.st_y() as 緯度 \n", | |
"from jumbo.geoshape \n", | |
"where lonlat.st_x() =139.786257 \n", | |
"and 番号<=3 \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "4f60ca66-188c-4de4-895a-5bb6732dff38", | |
"metadata": {}, | |
"source": [ | |
"#### 数値型データにキャストしたうえで書き込み\n", | |
"###### 緯度の方に0.002足して(北)、隅田川流心とする。築地方面と豊洲方面に分かれだす手前" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 11, | |
"id": "3e4e4c6d-b44c-4238-abde-d86d8b1c6b1a", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"Success: 1 rows affected" | |
] | |
}, | |
"execution_count": 11, | |
"metadata": { | |
"application/vnd.teradata.resultset": "" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"insert into jumbo.geoshape \n", | |
"with src as ( \n", | |
"\tselect \n", | |
"\t番号, \n", | |
"\t名前, \n", | |
"\tlonlat.st_x() as 経度, \n", | |
"\tlonlat.st_y() as 緯度 \n", | |
"\tfrom jumbo.geoshape \n", | |
"\twhere 番号=1 \n", | |
") \n", | |
"\tselect \n", | |
"\tcast(0 as integer) as 番号, \n", | |
"\tcast('隅田川流心' as varchar(10)) as 名前, \n", | |
"\tcast('point('||to_char(経度)||' '||to_char(緯度+0.002)||')' as st_geometry) as lonlat \n", | |
"\tfrom src \n", | |
"\t; " | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "fc464cac-36f1-450b-8267-abe766e22ed3", | |
"metadata": {}, | |
"source": [ | |
"#### 書き込んだデータの確認" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 12, | |
"id": "69f85712-3b3d-4913-bd5f-052444d372bc", | |
"metadata": { | |
"tags": [] | |
}, | |
"outputs": [ | |
{ | |
"data": { | |
"application/vnd.teradata.resultset": "\"番号\",\"名前\",\"lonlat\"\n\"1\",\"月島突端\",\"POINT (139.786257 35.671459)\"\n\"0\",\"隅田川流心\",\"POINT (139.786257 35.673459)\"", | |
"text/html": [ | |
"<div class = \"td-resultset-table-div\" style = \"max-height: 100%; overflow-y: auto\">\n", | |
" <table class=\"tdhistory100846\"><style>\n", | |
" table.tdhistory100846 { 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.tdhistory100846 { 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.tdhistory100846:last-child { text-align: left !important; }\n", | |
" tbody.tdhistory100846 tr:nth-child(even) { background: rgba(243, 243, 243, 0.75) !important; }\n", | |
" tbody.tdhistory100846 tr:nth-child(odd) { background: var(--jp-ui-inverse-font-color1) !important; }\n", | |
" td.tdhistory100846 { 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=\"tdhistory100846\"></th><th class=\"tdhistory100846\">番号</th><th class=\"tdhistory100846\">名前</th><th class=\"tdhistory100846\">lonlat</th></tr></thead><tbody class=\"tdhistory100846 resultset-body\"><tr><th class=\"tdhistory100846\" style= \"background: rgba(243, 243, 243, 0.75)\">1</th><td class=\"tdhistory100846\">1</td><td class=\"tdhistory100846\">月島突端</td><td class=\"tdhistory100846\">POINT (139.786257 35.671459)</td></tr><tr><th class=\"tdhistory100846\" style= \"background: rgba(243, 243, 243, 0.75)\">2</th><td class=\"tdhistory100846\">0</td><td class=\"tdhistory100846\">隅田川流心</td><td class=\"tdhistory100846\">POINT (139.786257 35.673459)</td></tr></tbody></table></div>" | |
] | |
}, | |
"execution_count": 12, | |
"metadata": { | |
"application/vnd.teradata.resultset": "{\"resultSetID\":\"C:\\\\\\\\Users\\\\\\\\youruserdirectory\\\\\\\\Teradata\\\\\\\\Resultsets\\\\\\\\2023.10.19_16.26.43.197_JST\",\"historyID\":48,\"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\":\"lonlat\",\"columnTypeName\":\"VARCHAR\",\"length\":30000,\"scale\":30000}]}" | |
}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"select \n", | |
"番号, \n", | |
"名前, \n", | |
"cast(lonlat as varchar(30000)) as lonlat \n", | |
"from jumbo.geoshape \n", | |
"where 番号 in (0,1) \n", | |
"; " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "a3ee0bd3-6a3c-4d88-aa04-4f1df64b0625", | |
"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