Huawei Query

Huawei Query

Certified

Run a SQL query on Huawei Cloud DLI (Data Lake Insight)

Submits a SQL statement as a DLI SQL job, waits for it to reach a terminal state, and returns its results — the Huawei Cloud equivalent of io.kestra.plugin.aws.athena.Query.

DLI queries data in OBS or federated sources (RDS, DWS, CSS, and more) via a serverless Spark SQL engine. Results are handled according to fetchType:

  • STORE (default): the full result set is exported to outputLocation on OBS, then downloaded and re-serialized as ION into Kestra internal storage. Use this for result sets that may exceed 1000 rows.
  • FETCH / FETCH_ONE: results are read directly from DLI's result preview API, which is capped at 1000 rows. Not supported on DLI's shared default queue — a dedicated DLI SQL queue is required for these fetch types.
  • NONE: the task returns as soon as the job reaches a terminal state, without fetching rows. Use this for DDL/DML statements that don't return a result set.

Authentication uses AK/SK request signing. Provide accessKeyId and secretAccessKey via {{ secret('NAME') }}, or configure temporaryCredentials for inline IAM credential exchange.

yaml
type: io.kestra.plugin.huawei.dli.Query

Run a query and store the full result set on OBS.

yaml
id: dli_query_store
namespace: company.team

tasks:
  - id: query
    type: io.kestra.plugin.huawei.dli.Query
    accessKeyId: "{{ secret('HUAWEI_AK') }}"
    secretAccessKey: "{{ secret('HUAWEI_SK') }}"
    region: eu-west-101
    sql: "SELECT * FROM my_database.my_table WHERE event_date = '2024-01-01'"
    database: my_database
    queue: my_queue
    outputLocation: "obs://my-bucket/dli-results/"

Run an aggregate query and fetch a single row directly.

yaml
id: dli_query_fetch_one
namespace: company.team

tasks:
  - id: query
    type: io.kestra.plugin.huawei.dli.Query
    accessKeyId: "{{ secret('HUAWEI_AK') }}"
    secretAccessKey: "{{ secret('HUAWEI_SK') }}"
    region: eu-west-101
    sql: "SELECT COUNT(*) AS total FROM my_database.my_table"
    database: my_database
    queue: my_queue
    fetchType: FETCH_ONE

Fire-and-forget a DDL statement without waiting for a result set.

yaml
id: dli_query_ddl
namespace: company.team

tasks:
  - id: create_table
    type: io.kestra.plugin.huawei.dli.Query
    accessKeyId: "{{ secret('HUAWEI_AK') }}"
    secretAccessKey: "{{ secret('HUAWEI_SK') }}"
    region: eu-west-101
    sql: "CREATE TABLE IF NOT EXISTS my_database.my_table (id INT, name STRING)"
    database: my_database
    queue: my_queue
    fetchType: NONE

Run a query against the Huawei Cloud European sovereign cloud.

yaml
id: dli_query_eu_sovereign
namespace: company.team

tasks:
  - id: query
    type: io.kestra.plugin.huawei.dli.Query
    accessKeyId: "{{ secret('HUAWEI_AK') }}"
    secretAccessKey: "{{ secret('HUAWEI_SK') }}"
    region: eu-west-101
    endpointSuffix: myhuaweicloud.eu
    projectId: "{{ secret('HUAWEI_PROJECT_ID') }}"
    sql: "SELECT * FROM my_database.my_table LIMIT 100"
    database: my_database
    queue: my_queue
    fetchType: FETCH
Properties

SQL statement to run

Any DLI-supported SQL: SELECT, DDL, DML, and more.

Access Key (AK) used to authenticate with Huawei Cloud

Huawei Cloud access key used together with secretAccessKey to sign API requests. Required for AK/SK-based authentication; not required when providing a pre-obtained securityToken. Sensitive — always provide via {{ secret('NAME') }}.

SubTypestring

Extra Spark/DLI configuration entries

Each entry is a key=value string, forwarded as-is to DLI's conf field.

Database to run the query against

Maps to DLI's currentdb. Optional if the query fully qualifies its table names.

Huawei Cloud Account Domain ID

Identifies the Huawei Cloud account (domain). Required when authenticating against global services such as IAM, or when requesting a domain-scoped IAM token.

DLI endpoint URL override

Overrides the default endpoint derived from region and endpointSuffix. Use this for private endpoints, non-standard deployments, or tests. When set, endpointSuffix is ignored.

Format: https://dli.<region>.myhuaweicloud.com (without trailing slash).

Huawei Cloud domain suffix

Controls the top-level domain used when deriving the DLI endpoint from region. Defaults to myhuaweicloud.com. Set to myhuaweicloud.eu for the Huawei Cloud European sovereign cloud.

Ignored when endpointOverride is set.

DefaultSTORE
Possible Values
STOREFETCHFETCH_ONENONE

How to handle the query result set

STORE (default) exports the full result to outputLocation on OBS and downloads it as ION. FETCH and FETCH_ONE read directly from DLI's preview API (capped at 1000 rows) and are not supported on the shared default queue (see queue). NONE returns as soon as the job completes, without fetching a result set.

DefaultPT5S

Polling interval while waiting for the job to complete

ISO-8601 duration (e.g. PT5S). Defaults to 5 seconds.

DefaultPT1H

Maximum time to wait for the query (and, for STORE, the export job) to complete

ISO-8601 duration (e.g. PT1H). Defaults to 1 hour. The DLI job is not automatically cancelled on timeout.

DefaultOBS
Possible Values
OBSV2V4

OBS request-signing type for the read-back

Defaults to OBS. Set to V2 for MinIO or other S3-compatible endpoints.

OBS endpoint URL override for the STORE result read-back

Overrides the endpoint used to read the exported result back from OBS. This is a separate host from the DLI endpointOverride — never reuse the DLI endpoint here. Defaults to the OBS endpoint derived from region and endpointSuffix.

Defaultfalse

Use path-style access for the OBS read-back

Set to true for MinIO or other S3-compatible endpoints. Defaults to false.

OBS location the result set is exported to

An obs://bucket/prefix URI. Required when fetchType is STORE.

Reference (ref) of the pluginDefaults to apply to this task.

Huawei Cloud Project ID

Identifies the region-scoped project against which most regional services authenticate. Mutually exclusive with domainId for global services such as IAM.

DLI queue to run the job on

Maps to DLI's queue_name. When omitted, the account's shared default queue is used. The default queue does not support fetching results via the preview API: fetchType FETCH/FETCH_ONE on the default queue (or with queue omitted) fails fast. Use fetchType STORE or NONE on the default queue, or run the query on a dedicated DLI SQL queue to use FETCH/FETCH_ONE.

Huawei Cloud region

Region identifier such as eu-west-101, ap-southeast-1, or cn-north-4.

Secret Key (SK) used to authenticate with Huawei Cloud

Huawei Cloud secret key paired with accessKeyId. Required for AK/SK-based authentication. Sensitive — always provide via {{ secret('NAME') }}.

Pre-obtained Huawei Cloud IAM token used as bearer credential for downstream API calls

When set, downstream Huawei tasks send this value in the X-Auth-Token header instead of signing requests with AK/SK. Sensitive.

Tags to attach to the DLI job

Inline IAM credential exchange

When set, the connection layer calls the Huawei IAM STS API once per task execution and uses the returned temporary AK/SK + security token instead of the static accessKeyId and secretAccessKey properties.

Configure once via pluginDefaults to apply transparently to every task in a namespace without per-task credential wiring:

pluginDefaults: 
  - type: io.kestra.plugin.huawei.obs
    values: 
      region: eu-west-101
      temporaryCredentials: 
        authMethod: PASSWORD
        username: my-iam-user
        password: "{{ secret('HUAWEI_IAM_PASSWORD') }}"
        domainName: my-account-domain
        durationSeconds: 3600

**Long-running tasks: ** the exchange runs once at execution start. For RealtimeTrigger or long-running Consume tasks that outlive durationSeconds, credentials will expire mid-run. Use long-lived AK/SK properties or refresh externally in that case.

Definitions
authMethodstring
DefaultPASSWORD
Possible Values
PASSWORDTOKEN

Authentication method

Controls which credentials are used to obtain the session token before exchanging for temporary STS credentials.

  • PASSWORD (default): provide username, password, and domainName.
  • TOKEN: provide an existing iamToken (X-Auth-Token).
domainNamestring

Account domain name (PASSWORD method only)

The Huawei Cloud account name (domain name) that owns the IAM user. Required when authMethod is PASSWORD. Visible in the Huawei Cloud console under My Credentials → Domain Name.

durationSecondsintegerstring
Default900

Lifetime of the temporary credentials in seconds

How long the returned temporary AK/SK/security-token should remain valid. Huawei Cloud accepts values between 900 (15 minutes) and 86400 (24 hours). Defaults to 900 seconds.

endpointSuffixstring
Defaultmyhuaweicloud.com

Huawei Cloud IAM endpoint suffix

Domain suffix used to build the IAM endpoint URL when no explicit endpoint override is set. Defaults to myhuaweicloud.com. Set to myhuaweicloud.eu for the European sovereign cloud (region eu-west-101 / EU-Dublin).

iamTokenstring

IAM token to exchange (TOKEN method only)

An existing Huawei Cloud X-Auth-Token to exchange for temporary STS credentials. Required when authMethod is TOKEN. Sensitive — always provide via {{ secret('NAME') }}.

passwordstring

IAM password (PASSWORD method only)

Password for the IAM user identified by username. Required when authMethod is PASSWORD. Sensitive — always provide via {{ secret('NAME') }}.

projectNamestring

Project name for project-scoped tokens (PASSWORD method only)

Overrides the project name used for scope=PROJECT token requests. Defaults to the task's region value when omitted, which is correct for most regions.

scopestring
DefaultPROJECT
Possible Values
PROJECTDOMAIN

Token scope (PASSWORD method only)

Scope of the session token obtained during password authentication.

  • PROJECT (default): token is scoped to the project matching projectName (or the task's region when projectName is omitted). Use for most downstream tasks.
  • DOMAIN: token is scoped to the domain.
usernamestring

IAM username (PASSWORD method only)

Huawei Cloud IAM username. Required when authMethod is PASSWORD.

DLI job ID of the SQL query

DLI job type

E.g. QUERY, DDL, DCL, INSERT.

First result row

Populated only when fetchType is FETCH_ONE.

SubTypeobject

Result rows

Populated only when fetchType is FETCH.

Number of rows fetched or stored

Terminal job status

FINISHED, FAILED, or CANCELLED.

Formaturi

URI of the ION file in Kestra internal storage containing the result set

Populated only when fetchType is STORE.

DLI-reported job execution duration, when available.

Unitrows

Number of rows fetched or stored from the DLI query result.