LinuxCommandLibrary

odps-func

Execute/Run ODPS (MaxCompute) functions

TLDR

Show functions in the current project

$ list functions;
copy

Create a Java function using a .jar resource
$ create function [func_name] as [path.to.package.Func] using '[package.jar]';
copy

Create a Python function using a .py resource
$ create function [func_name] as [script.Func] using '[script.py]';
copy

Delete a function
$ drop function [func_name];
copy

SYNOPSIS

odps-func function_name [arguments]

PARAMETERS

function_name
    The name of the ODPS function to execute.

[arguments]
    Optional arguments to pass to the ODPS function. These arguments must match the expected input types of the function.

DESCRIPTION

The `odps-func` command provides a way to execute user-defined functions (UDFs) registered in Alibaba Cloud's Open Data Processing Service (ODPS, also known as MaxCompute) directly from a Linux terminal. This is useful for testing UDFs, performing quick data transformations, or integrating ODPS functionality into shell scripts. The command handles connection to the ODPS environment, function invocation, and result retrieval. It simplifies the process of interacting with ODPS functions without needing to write full-fledged ODPS jobs. The output is typically printed to the standard output. It allows users to execute ODPS functions for data processing and transformation within a familiar command-line environment. You need to configure ODPS access credentials before using this tool.

Please note: This command assumes a correctly configured ODPS environment.

CONFIGURATION

Before running `odps-func`, you must configure access to your ODPS project. This often involves setting environment variables or using a configuration file to specify your ODPS endpoint, project name, and authentication credentials (e.g., AccessKey ID and AccessKey Secret).

DATA TYPES

Be mindful of the data types when providing arguments to the function. `odps-func` will pass the arguments as strings, so ensure that your UDF can correctly handle the data type conversions. If you expect a number, ensure that UDF converts string to number internally.

ERROR HANDLING

If an error occurs during function execution, `odps-func` will typically print an error message to the standard error stream.

Copied to clipboard