CData ODBC Driver for ADLS は、ODBC 経由でリアルタイムAzure Data Lake Storage Data に標準SQL での利用を可能にします。
ここでは、汎用ODBC データプロバイダーとしてAzure Data Lake Storage に接続し、データアナリティクスツールのExploratory (https://exploratory.io/) からAzure Data Lake Storage データを連携利用する手順を説明します。
Exploratory は、多くのRDB やRedshift、BigQuery などのクラウドデータストアに対応していますが、SaaS データを分析したい場合にはCData ODBC Drivers を使うことで、API コーディング不要でデータを活用できます。今回はAzure Data Lake Storage を例に説明します。
Azure Data Lake Storage Data に接続するODBC DSN を設定
ODBC Driver for ADLS をダウンロードします。次にマシンにAzure Data Lake Storage data に接続するODBC DSN を設定します。Exploratory からはそのODBC DSN を参照する形になります。ODBC DSN 設定の詳細については、ドキュメントを参照してください。
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.
Exploratory 上でAzure Data Lake Storage のデータをセット
- Exploratory で[コネクション]をクリックして新しいコネクションを作成します。
- [追加]→[ODBC]の順にクリック。
- コネクション追加画面で先ほど設定したAzure Data Lake Storage ODBC のDSN を設定します。
名前:任意
タイプ:ODBC
DSN:上の設定したDSN 名(CData Azure Data Lake Storage Sys)
- コネクションテストを下の地、[追加]を押して接続を確定させます。
Exploratory でAzure Data Lake Storage データをクエリし、データフレームとして保存
さあ、Exploratory からAzure Data Lake Storage データを扱ってみましょう。
- Exploratory でプロジェクトを[新規作成]します。
- [データフレーム]の[+]印をクリックし、[データベースデータ]を選択します。
- データベースは[ODBC]をクリック。
- [コネクション]で先ほど設定したAzure Data Lake Storage のコネクションを選択します。
- RDB ソースの感覚でSELECT クエリでAzure Data Lake Storage データをクエリします。標準SQL でフィルタリング、ソート、JOIN も可能です。
- データセットをデータフレームとして保存します。
Exploratory でのAzure Data Lake Storage データの分析
データフレームになったデータは通常のRDB データソースと同じようにExploratory で利用可能です。
このように、Exploratory から簡単にAzure Data Lake Storage データを接続して利用することができました。ODBC Driver には30日間の無償版がありますので、是非お試しください。