{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-@l10n/ja/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"ナレッジベースのクエリ","description":"Treasure Data Product Documentation · Collect and Unify · Segment and Activate · Experiment and Analyze · Decisioning Automate with AI Scale and Trust.","siteUrl":"https://docs.treasuredata.com","lang":"en-US","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"ナレッジベースのクエリ","__idx":0},"children":["ナレッジベースのクエリ"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["AIプロジェクト用のナレッジベースを作成した後、期待するデータがあることを確認するためにいくつかのクイッククエリを実行したいでしょう。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"クエリシミュレーション","__idx":1},"children":["クエリシミュレーション"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["このトピックには以下が含まれます。"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/ja/products/customer-data-platform/ai-agent-foundry/knowledgebase/querying-a-knowledge-base#list-columns-simulation-examples"},"children":["列リストシミュレーションの例"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/ja/products/customer-data-platform/ai-agent-foundry/knowledgebase/querying-a-knowledge-base#search-schema-simulation-examples"},"children":["スキーマ検索シミュレーションの例"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/ja/products/customer-data-platform/ai-agent-foundry/knowledgebase/querying-a-knowledge-base#query-data-directly-simulation-examples"},"children":["データ直接クエリシミュレーションの例"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Details"]},"タブを選択して、ナレッジベースの設定を確認できます"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-details.be1fce016409455ffc3f131bbd59a7d5cdd05aeb31b3e8d1818833d57d059bcf.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["ナレッジベースをシミュレートするには、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Test"]},"タブを選択します。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-test-tab.cbf883cee5ed1d5ff9f75d29497aa9c51cf56ec31981646440cc40d470a8b8e2.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"列リストシミュレーションの例","__idx":2},"children":["列リストシミュレーションの例"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["列リスト"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["テーブル名を入力します"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-list-columns.3813686296fca15161765ff28c170a76565b4443c27ce62e0684653d44d9e220.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"スキーマ検索シミュレーションの例","__idx":3},"children":["スキーマ検索シミュレーションの例"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["検索するキーワードを入力します"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-search-schema.14fb0c19c2af235561532a9f98b884d5183eaa218e363f73c08d63d1dfc69073.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"データ直接クエリシミュレーションの例","__idx":4},"children":["データ直接クエリシミュレーションの例"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["実行するSQLステートメントを入力します"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-query-data.949ac83a5176da23e5f6815daeef12dd040cd9eb72880be49aeacded115dbbd0.91c26685.png","alt":""},"children":[]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"クエリ結果フォーマットの理解","__idx":5},"children":["クエリ結果フォーマットの理解"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["データベースナレッジベースは、",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Markdown-KV"]},"と",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["JSON"]},"の2つの結果フォーマットをサポートしています。ナレッジベース作成時に選択したフォーマットによって、Testタブでのクエリ結果の表示方法が決まります。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"markdown-kv形式","__idx":6},"children":["Markdown-KV形式"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Format Typeとして",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Markdown-KV"]},"を選択した場合、クエリ結果は見出しとキー・バリューペアで構成された、構造化された読みやすい形式で返されます。"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["列リストの例:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-markdown-kv-list-columns.7bbfd81bd2cf34e5f04c824e7e20d15824363dec5374ef765c9db38057db3cd4.91c26685.png","alt":"Markdown-KV形式の列リスト結果"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["結果には、データベースとテーブル情報、各列の詳細が構造化された形式で表示されます:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"markdown","header":{"controls":{"copy":{}}},"source":"# Database \"retail_demo\"\n## Table \"customer_profiles\"\n### Column 1\nname: customer_id\ntype: varchar\ncomment:\n### Column 2\nname: first_name\ntype: varchar\ncomment:\n","lang":"markdown"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["データ直接クエリの例:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-markdown-kv-query-result.95cbbf9b4aead7c2b715eb070660805e584a79c30e656d34c71d933a93a1a313.91c26685.png","alt":"Markdown-KV形式のクエリ結果"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例えば、以下のクエリを実行すると:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"sql","header":{"controls":{"copy":{}}},"source":"SELECT customer_id, first_name, last_name, city, state \nFROM customer_profiles \nLIMIT 1\n","lang":"sql"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["次のような形式で結果が返されます:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"markdown","header":{"controls":{"copy":{}}},"source":"# Records\n## Record 1\ncustomer_id: CUST-00613\nfirst_name: Aiden\nlast_name: Hernandez\ncity: San Diego\nstate: CA\n","lang":"markdown"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["切り捨て警告:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["クエリ結果がMax rows制限を超えた場合、AIエージェントが結果が不完全であることを認識できるよう、警告メッセージが自動的に追加されます:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"img","attributes":{"src":"/assets/knowledge-base-markdown-kv-truncation-warning.df1c07dd7980ba9dd60c59de4a87b6877c87a4bf5410e602d2fc65da2f8029e4.91c26685.png","alt":"Markdown-KV形式の切り捨て警告"},"children":[]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["例えば、Max rowsが2に設定されているときに、より多くのレコードを取得しようとすると、以下の警告が表示されます:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"markdown","header":{"controls":{"copy":{}}},"source":"# Warning\n[TRUNCATED] Results limited to 2 rows. To retrieve more data, add pagination \nto your SQL query using OFFSET N LIMIT M (OFFSET must come before LIMIT), \nor add WHERE conditions to narrow the results.\n","lang":"markdown"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["この警告により、AIエージェントはページネーションまたは追加のフィルタリング条件を使用してクエリを絞り込むよう促されます。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"json形式","__idx":7},"children":["JSON形式"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Format Typeとして",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["JSON"]},"を選択した場合、クエリ結果は従来のJSON形式で返されます。これは以前のバージョンのナレッジベース機能と同様です。"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"主な違い","__idx":8},"children":["主な違い"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"機能"},"children":["機能"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Markdown-KV"},"children":["Markdown-KV"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"JSON"},"children":["JSON"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["結果の可読性"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["高 - 見出しとキー・バリューペアで構造化"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["中 - 標準的なJSON配列"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["切り捨て認識"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["結果が切り捨てられた際にエージェントが明示的な警告を受け取る"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["明示的な警告なし"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["テーブルフィルタリング"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["利用不可 - データベース内のすべてのテーブルが含まれる"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Table設定経由で利用可能"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Max rows / Timeout設定"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["完全サポート"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["制限あり、または無視される"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["次のステップ"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/products/customer-data-platform/ai-agent-foundry/ai-agent/creating-an-agent"},"children":["エージェントの作成"]}]}]},"headings":[{"value":"ナレッジベースのクエリ","id":"ナレッジベースのクエリ","depth":1},{"value":"クエリシミュレーション","id":"クエリシミュレーション","depth":2},{"value":"列リストシミュレーションの例","id":"列リストシミュレーションの例","depth":3},{"value":"スキーマ検索シミュレーションの例","id":"スキーマ検索シミュレーションの例","depth":3},{"value":"データ直接クエリシミュレーションの例","id":"データ直接クエリシミュレーションの例","depth":3},{"value":"クエリ結果フォーマットの理解","id":"クエリ結果フォーマットの理解","depth":2},{"value":"Markdown-KV形式","id":"markdown-kv形式","depth":3},{"value":"JSON形式","id":"json形式","depth":3},{"value":"主な違い","id":"主な違い","depth":3}],"frontmatter":{"seo":{"title":"ナレッジベースのクエリ"}},"lastModified":"2026-04-14T03:45:36.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/ja/products/customer-data-platform/ai-agent-foundry/knowledgebase/querying-a-knowledge-base","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}