ADO.NET Provider for REST

Build 23.0.8839

リレーショナルモデル

CData ADO.NET Provider for REST は、各XPath を主キーと親文書にリンクする外部キーを含む個別のテーブルとして扱うことで、データのリレーショナルモデルを作成するように設定できます。これは、リレーショナルデータモデルを想定している既存のBI、帳票、およびETL ツールでデータを処理する必要がある場合に特に役立ちます。

ネストされた配列をテーブルとして結合

DataModel を"Relational" に設定すると、どの結合もクエリによって制御されます。JOIN クエリを実行するときはいつでも、ファイルまたはソースはクエリに含まれる各テーブルに対して一度クエリされます。

以下は、XPath "/root/people"、"/root/people/vehicles"、および"/root/people/vehicles/maintenance" に基づくリレーショナルモデルを使用した、Raw データ のサンプルドキュメントに対するサンプルクエリです。

接続文字列

DataModel 接続プロパティを"Relational" に設定しXPath 接続プロパティを"/root/people;/root/people/vehicles;/root/people/vehicles/maintenance;" に設定して、次のクエリを実行してサンプル結果セットを表示します。

URI=C:\people.txt;Format=XML;DataModel=Relational;XPath='/root/people;/root/people/vehicles;/root/people/vehicles/maintenance;'

クエリ

次のクエリは、people(人)、vehicle(車両)、maintenance(メンテナンス)テーブルを明示的に結合します。

SELECT 
  [people].[personal.age] AS age, 
  [people].[personal.gender] AS gender, 
  [people].[personal.name.first] AS first_name, 
  [people].[personal.name.last] AS last_name, 
  [people].[source], 
  [vehicles].[type], 
  [vehicles].[model], 
  [vehicles].[insurance.company] AS ins_company, 
  [vehicles].[insurance.policy_num] AS ins_policy_num, 
  [maintenance].[date] AS maint_date, 
  [maintenance].[desc] AS maint_desc
FROM 
  [people]
JOIN 
  [vehicles] 
ON 
  [people].[_id] = [vehicles].[people_id]
JOIN 
  [maintenance] 
ON 
  [vehicles].[_id] = [maintenance].[vehicles_id]

結果

サンプルクエリでは、各maintenance エレメントはその親vehicle エレメントに結合され、さらにその親people エレメントに結合されて8行のテーブルを作成します(2 people それぞれに2 vehicles で、それぞれに2 maintenance エントリ)。

agegenderfirst_namelast_namesourcetypemodelins_companyins_policy_nummaint_datemaint_desc
20MJohnDoeinternetcarHonda CivicABC Insurance123452017-07-17oil change
20MJohnDoeinternetcarHonda CivicABC Insurance123452018-01-03new tires
20MJohnDoeinternettruckDodge RamABC Insurance123452017-08-27new tires
20MJohnDoeinternettruckDodge RamABC Insurance123452018-01-08oil change
24FJaneRobertsphonecarToyota CamryCar Insurance987652017-05-11tires rotated
24FJaneRobertsphonecarToyota CamryCar Insurance987652017-11-03oil change
24FJaneRobertsphonecarHonda AccordCar Insurance987652017-10-07new air filter
24FJaneRobertsphonecarHonda AccordCar Insurance987652018-01-13new brakes

関連項目

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