{"id":6779,"date":"2025-06-13T13:03:47","date_gmt":"2025-06-13T04:03:47","guid":{"rendered":"https:\/\/blog.since2020.jp\/?p=6779"},"modified":"2025-06-13T13:03:47","modified_gmt":"2025-06-13T04:03:47","slug":"genie-api-setup","status":"publish","type":"post","link":"https:\/\/since2020.jp\/media\/genie-api-setup\/","title":{"rendered":"\u3010Databricks\u3011Genie API\u3092\u7528\u3044\u3066\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u305f\u3081\u306e\u4e8b\u524d\u6e96\u5099"},"content":{"rendered":"\n<p>Databricks Genie API\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u30a2\u30d7\u30ea\u958b\u767a\u3059\u308b\u305f\u3081\u306e\u4e8b\u524d\u6e96\u5099\u3092\u89e3\u8aac\u3002Genie\u30b9\u30da\u30fc\u30b9\u306e\u4f5c\u6210\u304b\u3089Personal Access Token\u306e\u53d6\u5f97\u3001\u74b0\u5883\u5909\u6570\u8a2d\u5b9a\u307e\u3067\u3001\u81ea\u7136\u8a00\u8a9e\u3067\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30a2\u30d7\u30ea\u958b\u767a\u306b\u5fc5\u8981\u306a\u624b\u9806\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n<h2>\u306f\u3058\u3081\u306b<\/h2>\n<p>Databricks AI\/BI Genie\u306f\u3001<strong><span data-token-index=\"1\" class=\"notion-enable-hover\">\u30e6\u30fc\u30b6\u30fc\u304c\u81ea\u7136\u8a00\u8a9e\u3067\u554f\u3044\u5408\u308f\u305b\u308b\u3068LLM\u304c\u9069\u5207\u306a\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\u3001\u53ef\u8996\u5316\u3057\u3066\u304f\u308c\u308b<\/span><\/strong>\u6a5f\u80fd\u3067\u3059\u3002SQL\u3092\u66f8\u3051\u306a\u3044<strong><span data-token-index=\"3\" class=\"notion-enable-hover\">\u30d3\u30b8\u30cd\u30b9\u30b5\u30a4\u30c9\u306e\u30e6\u30fc\u30b6\u30fc\u3067\u3082\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3057\u793a\u5506\u3092\u5f97\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/span><\/strong>\u70b9\u304c\u975e\u5e38\u306b\u9b45\u529b\u7684\u3067\u3059\u3002<!-- notionvc: 174d2905-00fd-4cd4-9cb8-82ec96630664 --><\/p>\r\n<p>[blogcard url=&#8221;https:\/\/www.databricks.com\/jp\/product\/ai-bi\/genie&#8221;]<\/p>\r\n<p>Genie\u306b\u306fAPI\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002<strong><span data-token-index=\"1\" class=\"notion-enable-hover\">Genie Conversation API<\/span><\/strong>\uff08\u4ee5\u5f8c\u201dGenie API\u201d\uff09\u3092\u7528\u3044\u308c\u3070\u3001\u5916\u90e8\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089Genie\u3092\u547c\u3073\u51fa\u3057\u3001\u81ea\u7136\u8a00\u8a9e\u30d9\u30fc\u30b9\u3067Databricks\u306e\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<!-- notionvc: 3df73906-7ddf-4215-a48d-631f419df79d --><\/p>\r\n<p>[blogcard url=&#8221;https:\/\/docs.databricks.com\/aws\/ja\/genie\/conversation-api&#8221;]<\/p>\r\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001<strong>Genie API\u3092\u7528\u3044\u3066\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u4e8b\u524d\u6e96\u5099<\/strong>\u306b\u3064\u3044\u3066\u8a73\u7d30\u306b\u8aac\u660e\u3057\u307e\u3059\u3002Genie\u30b9\u30da\u30fc\u30b9\u306e\u4e8b\u524d\u6e96\u5099\u3084\u74b0\u5883\u5909\u6570\u306e\u6271\u3044\u306a\u3069\u3001\u3044\u304f\u3064\u304b\u7559\u610f\u3059\u308b\u3079\u304d\u70b9\u304c\u3042\u308a\u307e\u3059\u3002\u662f\u975e\u53c2\u8003\u306b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<!-- notionvc: 3d8e91a3-381a-4ce9-93c0-6439ea5632c5 --><\/p>\n\n<h2>STEP1: Genie\u30b9\u30da\u30fc\u30b9\u306e\u6e96\u5099<\/h2>\n<p>Genie API\u3092\u4f7f\u3046\u305f\u3081\u306b\u306f\u307e\u305a\u300cGenie\u30b9\u30da\u30fc\u30b9\u300d\u3092\u6e96\u5099\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002Genie\u30b9\u30da\u30fc\u30b9\u3068\u306f\u3001Databricks UI\u4e0a\u306eGenie\u30bf\u30d6\u304b\u3089\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u30c1\u30e3\u30c3\u30c8\u30eb\u30fc\u30e0\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3059\u3002<\/p>\r\n<p>[blogcard url=&#8221;https:\/\/docs.databricks.com\/aws\/ja\/genie\/&#8221;]<\/p>\r\n<p>Genie\u30b9\u30da\u30fc\u30b9\u306e\u4f5c\u6210\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001\u4ee5\u4e0b\u306e\u8a18\u4e8b\u3067\u8a73\u3057\u304f\u7d39\u4ecb\u3057\u3066\u304f\u3060\u3055\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<!-- notionvc: af440bee-913e-41f2-ad85-55aacb71d8a0 --><\/p>\r\n<p>[blogcard url=&#8221;https:\/\/qiita.com\/taka_yayoi\/items\/b7ca4df53000afe9ba02&#8243;]<\/p>\r\n<p>\u65b0\u3057\u304f\u30b9\u30ad\u30fc\u30de\u3092\u4f5c\u308b\u5834\u5408\u306f\u3001<span data-token-index=\"1\" class=\"notion-enable-hover\">\u4ed6\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u30a2\u30af\u30bb\u30b9\u6a29\u9650\uff08\u5177\u4f53\u7684\u306b\u306f<\/span><span data-token-index=\"2\" class=\"notion-enable-hover\">USE SCHEMA<\/span><span data-token-index=\"3\" class=\"notion-enable-hover\">\u6a29\u9650\uff09\u3092\u4ed8\u4e0e\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b<\/span>\u70b9\u306b\u6ce8\u610f\u304c\u5fc5\u8981\u304b\u3068\u601d\u3044\u307e\u3059\u3002<!-- notionvc: 2cb77e63-65f4-45c7-9898-1309e715830a --><\/p>\r\n<p>[blogcard url=&#8221;https:\/\/docs.databricks.com\/aws\/ja\/data-governance\/unity-catalog\/manage-privileges\/&#8221;]<\/p>\r\n<p><!-- notionvc: 2143dd61-bf4f-410c-9655-ee6ea24e48df --><\/p>\n\n<h2>STEP2: \u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u306e\u5165\u624b<\/h2>\n<p>\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u958b\u767a\u3059\u308b\u3068\u304d\u306bGenie API\u3092\u5229\u7528\u3057\u3066Genie\u30b9\u30da\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u306f\u3001<strong>Personal Access Token (PAT)<\/strong> \u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\r\n<p>Databricks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306b\u30ed\u30b0\u30a4\u30f3\u3057\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067PAT\u3092\u65b0\u898f\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\r\n<p>\u53f3\u4e0a\u306e\u30e6\u30fc\u30b6\u30fc\u30a2\u30a4\u30b3\u30f3 &gt; Settings &gt; Developer &gt; Accecc Tokens \u306e [Manage] \u3092\u30af\u30ea\u30c3\u30af &gt; [Create new token] \u3092\u30af\u30ea\u30c3\u30af<\/p>\r\n<p>\u4f55\u306b\u4f7f\u3046\u30c8\u30fc\u30af\u30f3\u306a\u306e\u304b\u3092\u8b58\u5225\u3067\u304d\u308b\u3088\u3046\u306b\u9069\u5207\u306b\u30b3\u30e1\u30f3\u30c8\u3092\u3064\u3051\u3001[Generate] \u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u65b0\u898fPAT\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\r\n<p><img decoding=\"async\" src=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2025\/06\/databricks-access-token.png\" alt=\"\" width=\"1302\" height=\"357\" class=\"aligncenter size-full wp-image-6781\" srcset=\"https:\/\/since2020.jp\/media\/wp-content\/uploads\/2025\/06\/databricks-access-token.png 1302w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2025\/06\/databricks-access-token-300x82.png 300w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2025\/06\/databricks-access-token-1024x281.png 1024w, https:\/\/since2020.jp\/media\/wp-content\/uploads\/2025\/06\/databricks-access-token-768x211.png 768w\" sizes=\"(max-width: 1302px) 100vw, 1302px\" \/><\/p>\r\n<p>\u65b0\u305f\u306b\u4f5c\u6210\u3057\u305fPAT\u306f\u30011\u5ea6\u3057\u304b\u8868\u793a\u3055\u308c\u306a\u3044\u306e\u3067\u5b89\u5168\u306a\u5834\u6240\u306b\u30e1\u30e2\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3002<!-- notionvc: d0bdd0d1-df01-49b5-af73-bbc43ad41f67 --><\/p>\r\n<p><!-- notionvc: 0df9c928-15da-445d-ba94-08d440337c2a --><\/p>\n\n<h2>STEP3: \u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9ID\u30fbGenie\u30b9\u30da\u30fc\u30b9ID\u306e\u5165\u624b<\/h2>\n<p>Genie API\u3092\u5229\u7528\u3057\u3066Genie\u30b9\u30da\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u305f\u3081\u306b\u306f\u3001Databricks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306eID\u3068\u30a2\u30af\u30bb\u30b9\u3057\u305f\u3044Genie\u30b9\u30da\u30fc\u30b9\u306eID\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\r\n<p>&nbsp;<\/p>\r\n<p>\u305d\u308c\u305e\u308c\u4ee5\u4e0b\u306eID\u3092\u53d6\u5f97\u3057\u3066\u304f\u3060\u3055\u3044\uff1a<\/p>\r\n<p><strong>Databricks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9ID\uff1aDatabricks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306eURL\u306e\u4ee5\u4e0b\u306e\u90e8\u5206<\/strong><\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>&lt;Databricks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9ID&gt;\/?o=xxxxxx\uff08https~.com\u307e\u3067\uff09<\/code><\/pre>\r\n<\/div>\r\n<p><strong>Genie\u30b9\u30da\u30fc\u30b9ID\uff1aGenie\u30b9\u30da\u30fc\u30b9\u3092\u958b\u3044\u305fURL\u306e\u4ee5\u4e0b\u306e\u90e8\u5206<\/strong><\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code>https:\/\/&lt;databricks-instance&gt;\/genie\/rooms\/&lt;Genie\u30b9\u30da\u30fc\u30b9ID&gt;?o=xxxxxx\uff08?o=\u306e\u524d\u307e\u3067\uff09<\/code><\/pre>\r\n<\/div>\r\n<p><!-- notionvc: 06271e65-2594-4666-ac5b-f23721a624a3 --><\/p>\n\n<h2>STEP4: \u74b0\u5883\u5909\u6570\u306e\u8a2d\u5b9a<\/h2>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3067<code>.env<\/code> \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u5148\u307b\u3069\u53d6\u5f97\u3057\u305f\u30c8\u30fc\u30af\u30f3\u3084ID\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># \u30ed\u30fc\u30ab\u30eb\u304b\u3089API\u3092\u547c\u3073\u51fa\u3059\u305f\u3081\u306ePersonal Access Token\r\nDATABRICKS_TOKEN=\"dapxxxxxxxxxxxxxxxx\"\r\n# Databracks\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u306eURL\r\nDATABRICKS_HOST=\"&lt;https:\/\/dbcxxxxxxxx.cloud.databricks.com&gt;\"\r\n# \u63a5\u7d9a\u3057\u305f\u3044Genie\u30b9\u30da\u30fc\u30b9\u306eID\r\nGENIE_SPACE_ID=\"xxxxxxxxxxxxxxxx\"<\/code><\/pre>\r\n<\/div>\r\n<p>\u3053\u306e\u74b0\u5883\u5909\u6570\u3092<code>app.py<\/code> (\u3042\u308b\u3044\u306f<code>main.py<\/code>\u306a\u3069) \u304b\u3089\u547c\u3073\u51fa\u3059\u305f\u3081\u306b\u4ee5\u4e0b\u3092\u8a18\u8ff0\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\r\n<div class=\"hcb_wrap\">\r\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>from dotenv import load_dotenv\r\n\r\nload_dotenv(\".env\")\r\n\r\nHOST = os.getenv(\"DATABRICKS_HOST\", \"\")\r\nTOKEN = os.getenv(\"DATABRICKS_TOKEN\", \"\")\r\nSPACE_ID = os.getenv(\"GENIE_SPACE_ID\", \"\")<\/code><\/pre>\r\n<\/div>\r\n<p><!-- notionvc: a9844e4e-0947-41e9-9c6e-5acb35ef48ea --><\/p>\n\n<h2>Genie API\u306e\u4f7f\u3044\u65b9<\/h2>\n<p>\u3053\u3053\u307e\u3067\u306e\u8a2d\u5b9a\u3067\u3001\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u304b\u3089Genie\u30b9\u30da\u30fc\u30b9\u306b\u30a2\u30af\u30bb\u30b9\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\r\n<p>\u3042\u3068\u306f\u5b9f\u969b\u306bAPI\u3092\u53e9\u3044\u3066\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u3059\u308b\u3060\u3051\u3067\u3059\uff01<\/p>\r\n<p>\u4eca\u56de\u306f\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067Genie API\u3092\u4f7f\u3048\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306e\u4e8b\u524d\u8a2d\u5b9a\u306b\u7126\u70b9\u3092\u5f53\u3066\u3066\u3044\u308b\u306e\u3067\u3001\u5b9f\u969b\u306eAPI\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u306f\u4ee5\u4e0b\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\r\n<ul>\r\n\t<li><a href=\"https:\/\/docs.databricks.com\/aws\/ja\/genie\/conversation-api\">https:\/\/docs.databricks.com\/aws\/ja\/genie\/conversation-api<\/a><\/li>\r\n\t<li><a href=\"https:\/\/docs.databricks.com\/api\/workspace\/introduction\">https:\/\/docs.databricks.com\/api\/workspace\/introduction<\/a><\/li>\r\n<\/ul>\r\n<p><!-- notionvc: eea857ad-91f2-484d-99d6-643096035b40 --><\/p>\n\n<h2>\u304a\u308f\u308a\u306b<\/h2>\n<p>\u672c\u8a18\u4e8b\u3067\u306f\u3001Genie API\u3092\u7528\u3044\u3066\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3059\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u4e8b\u524d\u6e96\u5099\u306b\u3064\u3044\u3066\u8a73\u7d30\u306b\u8aac\u660e\u3057\u307e\u3057\u305f\u3002Genie API\u3092\u4f7f\u3048\u3070\u3001SQL\u3092\u66f8\u3051\u306a\u3044\u30e6\u30fc\u30b6\u304c\u81ea\u7136\u8a00\u8a9e\u3067\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\u3067\u304d\u308b\u6a5f\u80fd\u3092\u5916\u90e8\u30a2\u30d7\u30ea\u306b\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u307e\u3059\u3002\u305c\u3072\u672c\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<!-- notionvc: 4513d07f-7c86-4b67-ab56-de1d42bbb027 --><\/p>","protected":false},"excerpt":{"rendered":"<p>Databricks Genie API\u3092\u4f7f\u3063\u3066\u30ed\u30fc\u30ab\u30eb\u74b0\u5883\u3067\u30a2\u30d7\u30ea\u958b\u767a\u3059\u308b\u305f\u3081\u306e\u4e8b\u524d\u6e96\u5099\u3092\u89e3\u8aac\u3002Genie\u30b9\u30da\u30fc\u30b9\u306e\u4f5c\u6210\u304b\u3089Personal Access Token\u306e\u53d6\u5f97\u3001\u74b0\u5883\u5909\u6570\u8a2d\u5b9a\u307e\u3067\u3001\u81ea\u7136\u8a00\u8a9e\u3067\u30c7\u30fc\u30bf\u306b\u30a2\u30af\u30bb\u30b9 [&hellip;]<\/p>\n","protected":false},"author":46,"featured_media":6170,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"content-type":"","swell_btn_cv_data":"","footnotes":"","_wp_rev_ctl_limit":""},"categories":[1249],"tags":[96,145,774,133],"class_list":["post-6779","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-knowledge","tag-ai","tag-api","tag-databricks","tag-dwh"],"_links":{"self":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/6779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/users\/46"}],"replies":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/comments?post=6779"}],"version-history":[{"count":0,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/posts\/6779\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media\/6170"}],"wp:attachment":[{"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/media?parent=6779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/categories?post=6779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/since2020.jp\/media\/wp-json\/wp\/v2\/tags?post=6779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}