本記事では CData サポート担当からこんなことを聞かれたらどこを確認すべきか?という観点で、よく頂くお問合せ内容をご紹介します。
記事はこちら →CData ODBC Drivers は、ODBC ドライバーをサポートするあらゆる環境から利用可能です。本記事では、PyCharm からのCData ODBC Driver for AzureDataCatalog の利用を説明します。CData ODBC Deriver をデータソースとして設定する方法、データソースをクエリして結果を表示するためのPyCharm の簡単なコードを含みます。
はじめに、このチュートリアルではCData ODBC Driver for AzureDataCatalog とPyCharm が、既にインストールされていることを前提としています。
以下のステップに従って、pyodbc モジュールをプロジェクトに追加します。
これで、ODBC 接続文字列またはDSN で接続できます。お客様のOS でDSN を作成するためのガイドについては、CData ドライバードキュメントの[はじめに]セクションを参照してください。
You can optionally set the following to read the different catalog data returned from Azure Data Catalog.
You must use OAuth to authenticate with Azure Data Catalog. OAuth requires the authenticating user to interact with Azure Data Catalog using the browser. For more information, refer to the OAuth section in the help documentation.
以下はDSN の構文です。
[CData AzureDataCatalog Source]
Driver = CData ODBC Driver for AzureDataCatalog
Description = My Description
Cursor をインスタンス化し、Cursor クラスのexecute メソッドを使用してSQL ステートメントを実行します。
import pyodbc
cnxn = pyodbc.connect('DRIVER={CData ODBC Driver for AzureDataCatalog};')
cursor = cnxn.cursor()
cursor.execute("SELECT DslAddressDatabase, Type FROM Tables WHERE Name = 'FactProductInventory'")
rows = cursor.fetchall()
for row in rows:
print(row.DslAddressDatabase, row.Type)
CData ODBC Driver を使用してPyCharm でAzure Data Catalog に接続すると、Azure Data Catalog にアクセスできるPython アプリケーションを標準データベースのように構築できるようになります。このチュートリアルに関する質問、コメント、フィードバックがある場合には、support@cdata.com までご連絡ください。