将 Dataplex Discover 迁移到 BigQuery Studio

Dataplex 将停止对“探索”功能的支持。本文档简要介绍了 将 Dataplex Discover 资源迁移到 BigQuery Studio。您可以迁移 Spark SQL 和 JupyterLab 笔记本 BigQuery Studio,一种统一的数据探索工具, 平台。

已弃用的功能

如有疑问或需要澄清,请与“探索”团队联系: dataplex-explore-support@google.com.

准备工作

  • 启用 BigQuery and BigQuery Studio API。

    启用 API

笔记本内容

如果您在“探索”部分有笔记本在 迁移之后,您将会在 Google Cloud 中 BigQuery Studio。

BigQuery Studio 提供了一个笔记本界面 与 Colab Enterprise 不同,与 Google Cloud 相比, JupyterLab 笔记本。您仍然可以编写、保存和运行笔记本 在 BigQuery Studio 中以无服务器方式运行。此外,您还可以 受益于 Colab Enterprise 集成式云环境 具有强大的 GPU 和 TPU 以及实时协作、共享和访问权限控制功能 自动保存、预装的库、免费使用 配额、内置微件和扩展程序,以及与其他 Google 服务(例如 BigQuery 和 Cloud Storage)

Spark SQL 内容

Dataplex Discovery 会将发现的表注册到 BigQuery 和 Dataproc Metastore。根据 表已注册,请使用以下迁移选项之一。

  • 表在 Dataproc Metastore 和 BigQuery:如果 Spark SQL 脚本与 Dataplex 通过 Dataproc Metastore 发现的表; 那么您可以直接通过 Cloud 控制台查询这些表 BigQuery
  • 表仅在 Dataproc Metastore 中注册:如果 Spark SQL 脚本与 BigQuery 中不可用的表交互, 您需要设置 BigQuery Studio 集成 Dataproc Metastore。Dataproc Metastore 两种类型的端点:Thrift 和 gRPC。如需详细了解如何查找端点协议,请参阅 查找端点 URI 值。 然后,按照以下步骤设置 BigQuery Studio 集成 部分。

连接到基于 Thrift 的 Dataproc Metastore

基于 Thrift 的端点以 thrift:// 开头。要连接到 Dataproc Metastore,传递 SparkSession 配置,如以下示例所示:

from pyspark.sql import SparkSession

spark = (
    SparkSession.builder.appName("Dataproc Metastore Connection")
    .config(
        "spark.hadoop.hive.metastore.uris",
        "thrift://IP_ADDRESS:9083",
    )
    .enableHiveSupport()
    .getOrCreate()
)

连接到基于 gRPC 的端点

基于 gRPC 的端点以 https:// 开头。Spark 无法连接到非 Thrift 端点您必须运行代理服务 将请求从 Thrift 转换为 gRPC。要连接到基于 gRPC 的 Dataproc Metastore 服务,请在 BigQuery Studio 笔记本:

  1. 在 在笔记本中运行以下命令:

    # Download the latest HMS Proxy jar file.
    !gsutil cp gs://metastore-init-actions/metastore-grpc-proxy/hms-proxy-3.1.2-v0.0.46.jar
    
  2. 启动 HMS 代理。

    %%bash
    # Metastore store URI including the port number but without "https://" prefix.
    METASTORE_URI=METASTORE_URI
    # HMS Proxy JAR path.
    JAR_PATH=JAR_PATH
    # DPMS Supported Hive Version.
    HIVE_VERSION=3.1.2
    
    # Start the HMS Proxy.
    java -jar ${JAR_PATH} --conf proxy.mode=thrift proxy.uri=${METASTORE_URI} thrift.listening.port=9083 hive.version=${HIVE_VERSION} google.credentials.applicationdefault.enabled=true proxy.grpc.ssl.upstream.enabled=true > /tmp/hms.logs 2>&1 &
    
  3. 将 Spark 会话连接到本地 HMS 代理。

    from pyspark.sql import SparkSession
    
    spark = (
      SparkSession.builder.appName("Dataproc Metastore Connection")
      .config(
          "spark.hadoop.hive.metastore.uris",
          "thrift://localhost:9083",
      )
      .enableHiveSupport()
      .getOrCreate()
    )
    

会话资源

会话资源是指特定于用户的活跃会话。迁移 会话资源不受支持。

环境资源

环境可为您的 Spark SQL 查询提供无服务器计算资源 在数据湖内运行的笔记本和笔记本。由于 BigQuery Studio 提供了 一个用于运行 SQL 查询和笔记本的无服务器环境, 环境资源不受支持。

使用内容资源安排任务

您可以在 BigQuery Studio 中安排查询