【问题标题】:Dataproc hive operator not running hql file stored in storage bucketDataproc 配置单元操作员未运行存储在存储桶中的 hql 文件
【发布时间】:2017-09-20 07:01:49
【问题描述】:

我正在尝试使用气流脚本运行云存储中存在的 hql 文件,我们可以通过两个参数将路径传递给 DataprocHiveOperator:

  1. 查询:'gs://bucketpath/filename.q'

Error occuring - cannot recognize input near 'gs' ':' '/'

  1. query_uri :'gs://bucketpath/filename.q'

Error occuring: PendingDeprecationWarning: Invalid arguments were passed to DataProcHiveOperator. Support for passing such arguments will be dropped in Airflow 2.0. Invalid arguments were: *args: () **kwargs: {'query_uri': 'gs://poonamp_pcloud/hive_file1.q'

使用 Query param ,我已经成功运行 hive 查询(select * from table)

有没有办法通过dataprochiveoperator运行存储在云存储桶中的hql文件?

【问题讨论】:

  • 我正在尝试使用 composer 在 dataproc 上运行配置单元查询。我们应该将数据存储在哪里?它是在 Bucket 还是 dataproc 本身上。
  • 嘿@JohnConstantine,您可以通过两种方式做到这一点。 1)您可以通过选择查询直接在dataproc本身上发出查询命令,否则您需要选择查询文件并且需要将您的查询文件存储在google存储桶中,然后您需要提供该位置。显示的示例here
  • @aditi 如果对您有帮助,请将答案标记为正确。谢谢

标签: python hive airflow google-cloud-dataproc apache-airflow


【解决方案1】:

这是因为您同时使用 queryquery_uri

如果您使用文件查询,则必须使用 query_uriquery = None 或者您可以忽略编写查询。

如果您使用的是 inline query,那么您必须使用 query

这是一个通过文件查询的示例。

HiveInsertingTable = DataProcHiveOperator(task_id='HiveInsertingTable',
    gcp_conn_id='google_cloud_default', 
    queri_ury="gs://us-central1-bucket/data/sample_hql.sql",
    cluster_name='cluster-name',
    region='us-central1',
    dag=dag)

【讨论】:

    【解决方案2】:

    query_uri 确实是从 Cloud Storage 运行 hql 文件的正确参数。但是,它只添加到https://github.com/apache/incubator-airflow/pull/2402 中的DataProcHiveOperator。根据您收到的警告消息,我认为您没有在支持该参数的代码上运行。该更改不在最新版本 (1.8.2) 上,因此您需要等待另一个版本或从主分支中获取它。

    【讨论】:

      猜你喜欢
      • 2022-01-11
      • 1970-01-01
      • 2016-11-13
      • 2016-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多