ODBC Driver for Couchbase

Build 23.0.8839

自動スキーマ検出

子テーブル

バケット内のドキュメントに配列を含むフィールドが含まれる場合、本製品 はそれらのフィールドをメインテーブルのJSON 集計として公開するだけでなく、独自のテーブルとして公開します。これらの子テーブルの構造は、配列にオブジェクトまたはプリミティブ値が含まれるかどうかによって異なります。

配列の子テーブル

配列に数値や文字列などのプリミティブな値が含まれる場合、子テーブルには2つのカラムしかありません。配列を含むドキュメントの主キーである"Document.Id" と、配列内の値を含む"value" です。例えば、"Games" というバケットにこれらのドキュメントが含まれる場合:

/* Primary key "1" */
{
  "scores": [1,2,3]
}

/* Primary key "2" */
{
  "scores": [4,5,6]
}

本製品 は、これらの行を含む"Games_scores" という名前のテーブルをビルドします:

Document.Id value
1 1
1 2
1 3
2 4
2 5
2 6

オブジェクトの子テーブル

配列にオブジェクトが含まれる場合、子テーブルには、そのオブジェクト内にある各フィールドのカラムと、その配列を含むドキュメントの主キーを含む"Document.Id" カラムがあります。例えば、"Games" というバケットにこれらのドキュメントが含まれる場合:

/* Primary key "1" */
{
  "moves": [
    {"piece": "pawn", "square": "c3"},
    {"piece": "rook", "square": "d5"}
  ]
}

/* Primary key "2" */
{
  "moves": [
    {"piece": "knight", "square": "f1"},
    {"piece": "bishop", "square": "e4"}
  ]
}

本製品 は、これらの行を含む"Games_moves" という名前のテーブルをビルドします:

Document.Id piece square
1 pawn c3
1 rook d5
2 knight f1
2 biship e4

NewChildJoinsMode

Note that the above data model is not fully relational, which has important limitations for use-cases that involve complex JOINs or DML operations on child tables. The NewChildJoinsMode connection property exposes an alternative data model which avoids these limitations. Please refer to its page in the connection property section of the documentation for more details.

フレーバーテーブル

本製品 は、TypeDetectionScheme がInfer またはDocType に設定され、CouchbaseService がN1QL に設定されている限り、同じバケット内に複数の種類のドキュメントが存在する場合も検出できます。これらの異なる種類のドキュメントは、適切な行のみを含む独自のテーブルとして公開されています。

例えば、"Games" というバケットには、"type" の値が "chess" または"football" のいずれかであるドキュメントが含まれています:

/* Primary key "1" */
{
  "type": "chess",
  "result": "stalemate"
}

/* Primary key "2" */
{
  "type": "chess",
  "result": "black win"
}

/* Primary key "3" */
{
  "type": "football",
  "score": 23
}

/* Primary key "4" */
{
  "type": "football",
  "score": 18
}

本製品 はこのバケット用に3テーブル作成します。1つは、すべてのドキュメントを含む"Games" と呼ばれるバケットです:

Document.Id result score type
1 stalemate NULL chess
2 black win NULL chess
3 NULL 23 football
4 NULL 18 football

1つは、type が"chess" であるドキュメントのみを含む"Games.chess" と呼ばれるものです。

Document.Id result type
1 stalemate chess
2 black win chess

1つは、type が"football" であるドキュメントのみを含む"Games.football" と呼ばれるものです。

Document.Id score type
3 23 football
4 18 football

本製品 は、そのフレーバーのドキュメントで定義されていないフレーバーテーブルのカラムを含みません。例えば、"result" と"score" の両カラムが基本テーブルに含まれていても、"Games.chess" には"result" だけ、"Games.football" には"score" だけが含まれます。

フレーバーの子テーブル

フレーバーテーブルに配列を含めることもできます。これは独自の子テーブルになります。例えば、"Games" というバケットにこれらのドキュメントが含まれる場合:
/* Primary key "1" */
{
  "type": "chess",
  "results": ["stalemate", "white win"]
}

/* Primary key "2" */
{
  "type": "chess",
  "results": ["black win", "stalemate"]
}

/* Primary key "3" */
{
  "type": "football",
  "scores": [23, 12]
}

/* Primary key "4" */
{
  "type": "football",
  "scores": [18, 36]
}
本製品 はこれらのテーブルを生成します。

テーブル名 子フィールド フレーバーコンディション
Games
Games_results results
Games_scores scores
Games.chess "type" = "chess"
Games.chess_results results "type" = "chess"
Games.football "type" = "football"
Games.football_scores scores "type" = "football"

Copyright (c) 2024 CData Software, Inc. - All rights reserved.
Build 23.0.8839