次の方法で共有


ADLS に接続して、Azure Databricks でデータを変換する

このガイドで行うこと:

  • Azure Databricks を使用して Azure Data Lake Storage (ADLS) Gen2 アカウントに Delta テーブルを作成します。

  • ADLS の Delta テーブルへの OneLake ショートカットを作成します。

  • Power BI を使用して ADLS ショートカットを使用したデータを分析します。

前提条件

開始する前に、以下が必要になります:

  • Lakehouse 項目を含むワークスペース

  • Azure Databricks ワークスペース

  • Delta テーブルを格納する ADLS Gen2 アカウント

Delta テーブルの作成、ショートカットの作成、データの分析

  1. Azure Databricks ノートブック を使用して、ADLS Gen2 アカウントに Delta テーブルを作成します。

     # Replace the path below to refer to your sample parquet data with this syntax "abfss://<storage name>@<container name>.dfs.core.windows.net/<filepath>"
    
     # Read Parquet files from an ADLS account
     df = spark.read.format('Parquet').load("abfss://datasetsv1@olsdemo.dfs.core.windows.net/demo/full/dimension_city/")
    
     # Write Delta tables to ADLS account
     df.write.mode("overwrite").format("delta").save("abfss://datasetsv1@olsdemo.dfs.core.windows.net/demo/adb_dim_city_delta/")
    
  2. レイクハウスで、[テーブル] の横にある省略記号 (...) をクリックし、[新しいショートカット] を選択します。

    Screenshot showing location of New Shortcut in Tables.

  3. [新しいショートカット] 画面で、[Azure Data Lake Storage Gen2] タイルを選択します。

    Screenshot of the tile options in the New shortcut screen.

  4. このショートカットの接続の詳細を指定し、[次へ] を選択します。

    Screenshot showing where to enter the Connection settings for a new shortcut.

  5. ショートカットの詳細を指定します。 [ショートカット名][サブ パス] を指定し、[作成] を選択します。 サブ パスは、Delta テーブルが存在するディレクトリを指している必要があります。

    Screenshot showing where to enter new shortcut details.

  6. ショートカットは、[テーブル] の下に Delta テーブルとして表示されます。

    Screenshot showing location of newly created ADLS shortcut.

  7. これで、ノートブックから直接このデータに対してクエリを実行できるようになりました。

    df = spark.sql("SELECT * FROM lakehouse1.adls_shortcut_adb_dim_city_delta LIMIT 1000")
    display(df)
    
  8. Power BI 経由でこの差分テーブルにアクセスして分析するには、[新しい Power BI セマンティック モデル] を選択します。

    Screenshot showing how to create new Power BI semantic model.

  9. ショートカットを選択し、[確認する] を選択します。

    Screenshot showing new semantic model setup.

  10. データが発行されたら、[最初から始める] を選択します。

    Screenshot showing process to set up a dataset.

  11. レポート作成エクスペリエンスでは、ショートカット データはテーブルとして、すべての属性と共に表示されます。

    Screenshot showing authoring experience and table attributes.

  12. Power BI レポートを作成するには、左側のペインに属性をドラッグします。

    Screenshot showing data being queried through Power BI report.