Airflow Summit 2025 is coming October 07-09. Register now for early bird ticket!

airflow.providers.alibaba.cloud.hooks.maxcompute

Attributes

RT

Classes

MaxComputeHook

Interact with Alibaba MaxCompute (previously known as ODPS).

Functions

fallback_to_default_project_endpoint(func)

Provide fallback for MaxCompute project and endpoint to be used as a decorator.

Module Contents

airflow.providers.alibaba.cloud.hooks.maxcompute.RT[source]
airflow.providers.alibaba.cloud.hooks.maxcompute.fallback_to_default_project_endpoint(func)[source]

Provide fallback for MaxCompute project and endpoint to be used as a decorator.

If the project or endpoint is None it will be replaced with the project from the connection extra definition.

Parameters:

func (Callable[Ellipsis, RT]) – function to wrap

Returns:

result of the function call

Return type:

Callable[Ellipsis, RT]

class airflow.providers.alibaba.cloud.hooks.maxcompute.MaxComputeHook(maxcompute_conn_id='maxcompute_default', **kwargs)[source]

Bases: airflow.providers.alibaba.cloud.hooks.base_alibaba.AlibabaBaseHook

Interact with Alibaba MaxCompute (previously known as ODPS).

Parameters:

maxcompute_conn_id (str) – The connection ID to use when fetching connection info.

conn_name_attr = 'maxcompute_conn_id'[source]
default_conn_name = 'maxcompute_default'[source]
conn_type = 'maxcompute'[source]
hook_name = 'MaxCompute'[source]
maxcompute_conn_id = 'maxcompute_default'[source]
classmethod get_connection_form_widgets()[source]

Return connection widgets to add to connection form.

classmethod get_ui_field_behaviour()[source]

Return custom field behaviour.

property project: str[source]

Returns project ID.

Returns:

ID of the project

Return type:

str

property endpoint: str[source]

Returns MaxCompute Endpoint.

Returns:

Endpoint of the MaxCompute project

Return type:

str

get_client(*, project, endpoint)[source]

Get an authenticated MaxCompute ODPS Client.

Parameters:
  • project_id – Project ID for the project which the client acts on behalf of.

  • location – Default location for jobs / datasets / tables.

run_sql(*, sql, project=None, endpoint=None, priority=None, running_cluster=None, hints=None, aliases=None, default_schema=None, quota_name=None)[source]

Run a given SQL statement in MaxCompute.

The method will submit your SQL statement to MaxCompute and return the corresponding task Instance object.

Parameters:
Returns:

The MaxCompute task instance.

Return type:

odps.models.Instance

get_instance(*, instance_id, project=None, endpoint=None)[source]

Get a MaxCompute task instance.

Parameters:
  • instance_id (str) – The ID of the instance to get.

  • project (str | None) – The project ID to use.

  • endpoint (str | None) – The endpoint to use.

Returns:

The MaxCompute task instance.

Raises:

ValueError – If the instance does not exist.

Return type:

odps.models.Instance

stop_instance(*, instance_id, project=None, endpoint=None)[source]

Stop a MaxCompute task instance.

Parameters:
  • instance_id (str) – The ID of the instance to stop.

  • project (str | None) – The project ID to use.

  • endpoint (str | None) – The endpoint to use.

Was this entry helpful?