CData JDBC Driver for ADLS の強みの一つは、クロスプラットフォームのサポートであり、主要なBI ツールとの統合を可能にします。以下のステップに従って、KNIME のAzure Data Lake Storage にアクセスし、レポートデザイナを使用してAzure Data Lake Storage からチャートを作成します。
CData JDBC Driver for ADLS を使用することで、JDBC データソースとしてAzure Data Lake Storage にアクセスでき、IDE の迅速な開発ツールとの統合が可能になります。この記事では、データソース構成ウィザードを使用してIntelliJ のAzure Data Lake Storage に接続する方法を示します。
Azure Data Lake Storage データへの新しいJDBC 接続を定義します。
- Report Designer 機能をインストールします。[File]->[Install KNIME Extensions]とクリックし、[Report]でフィルタリングします。
- 新しいワークフローで[File]->[Preferences]をクリックし、[KNIME]->[Databases]でノードを展開し cdata.jdbc.adls.jar を追加します。
- ドライバーJAR は、インストールディレクトリのlib サブフォルダにあります。
-
[Node Repository]ビューで[Database]->[Read/Write]とノードを展開し、[Database Reader]をワークフローエディターにドラッグします。
-
[Database Reader]をダブルクリックし、次のプロパティを設定します。
- Database Driver:メニューでドライバーの名前(cdata.jdbc.adls.ADLSDriver)を選択します。
Database URL:接続プロパティを入力します。jdbc:adls: から始まり、その後にセミコロンで区切られた接続プロパティのリストが続くJDBC URL を入力します。
Authenticating to a Gen 1 DataLakeStore Account
Gen 1 uses OAuth 2.0 in Azure AD for authentication.
For this, an Active Directory web application is required. You can create one as follows:
- Sign in to your Azure Account through the
[.
]- Select "Azure Active Directory".
- Select "App registrations".
- Select "New application registration".
- Provide a name and URL for the application. Select Web app for the type of application you want to create.
- Select "Required permissions" and change the required permissions for this app. At a minimum, "Azure Data Lake" and "Windows Azure Service Management API" are required.
- Select "Key" and generate a new key. Add a description, a duration, and take note of the generated key. You won't be able to see it again.
To authenticate against a Gen 1 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen1.
- Account: Set this to the name of the account.
- OAuthClientId: Set this to the application Id of the app you created.
- OAuthClientSecret: Set this to the key generated for the app you created.
- TenantId: Set this to the tenant Id. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
Authenticating to a Gen 2 DataLakeStore Account
To authenticate against a Gen 2 DataLakeStore account, the following properties are required:
- Schema: Set this to ADLSGen2.
- Account: Set this to the name of the account.
- FileSystem: Set this to the file system which will be used for this account.
- AccessKey: Set this to the access key which will be used to authenticate the calls to the API. See the property for more information on how to acquire this.
- Directory: Set this to the path which will be used to store the replicated file. If not specified, the root directory will be used.
ビルトイン接続文字列デザイナ
JDBC URL の構成については、Azure Data Lake Storage JDBC Driver に組み込まれている接続文字列デザイナを使用してください。JAR ファイルのダブルクリック、またはコマンドラインからJAR ファイルを実行します。
java -jar cdata.jdbc.adls.jar
接続プロパティを入力し、接続文字列をクリップボードにコピーします。
JDBC URL を構成する際に、Max Rows プロパティを定めることも可能です。これによって戻される行数を制限するため、可視化・レポートのデザイン設計時のパフォーマンスを向上させるのに役立ちます。
以下は一般的なJDBC URL です。
jdbc:adls:Schema=ADLSGen2;Account=myAccount;FileSystem=myFileSystem;AccessKey=myAccessKey;InitiateOAuth=GETANDREFRESH
- User Name:認証に使用されるユーザー名
- Password:認証に使用されるパスワード
- SQL Statement:[SQL Statement]ボックスにSQL クエリを入力するか、テーブルをダブルクリックします。この記事では、チャートの作成に以下のクエリを用います。
SELECT FullPath, Permission FROM Resources WHERE Type = 'FILE'
-
[Fetch Metadata]をクリックして接続を確認します。
-
[Database Reader]を[Data to Report]ノードに接続し、データセットを様々なデータ可視化コントロールに提供します。[Execute]をクリックし、ワークフローの上部にある[Edit Report]をクリックしてレポートデザイナパースペクティブを開きます。
-
ライブデータに基づいてレポートを作成できます。チャートを作成するには、チャートコントロールをパレットからレポートデザイナにドラッグします。表示されるウィザードでは、KNIME で使用可能なフィルタリングおよび集約コントロールを使用できます。
トラブルシューティング
次のリストは一般的なエラーを解決する方法を示しています。
- [Row1]という重複するIdが見つかりました。:このエラーを解決するには、KNIME インストールディレクトリにあるknime.ini ファイルに
-Dknime.database.fetchsize=0
を追加します。