flytekit.extend.SQLTask

class flytekit.extend.SQLTask(*args, **kwargs)[source]

Base task types for all SQL tasks

__init__(name: str, query_template: str, task_type='sql_task', inputs: Optional[Dict[str, Type]] = None, metadata: Optional[flytekit.core.base_task.TaskMetadata] = None, task_config: Optional[T] = None, outputs: Optional[Dict[str, Type]] = None, **kwargs)[source]

Args: task_type: a string that defines a unique task-type for every new extension. If a backend plugin is required

then this has to be done in-concert with the backend plugin identifier

name: A unique name for the task instantiation. This is unique for every instance of task. task_config: Configuration for the task. This is used to configure the specific plugin that handles this task interface: A python native typed interface (inputs) -> outputs that declares the signature of the task environment: Any environment variables that should be supplied during the execution of the task. Supplied as

a dictionary of key/value pairs

Methods

__init__(name, query_template[, task_type, …])

Args: task_type: a string that defines a unique task-type for every new extension. If a backend plugin is required then this has to be done in-concert with the backend plugin identifier name: A unique name for the task instantiation. This is unique for every instance of task. task_config: Configuration for the task. This is used to configure the specific plugin that handles this task interface: A python native typed interface (inputs) -> outputs that declares the signature of the task environment: Any environment variables that should be supplied during the execution of the task. Supplied as a dictionary of key/value pairs.

compile(ctx, *args, **kwargs)

dispatch_execute(ctx, input_literal_map)

This method translates Flyte’s Type system based input values and invokes the actual call to the executor This method is also invoked during runtime.

execute(**kwargs)

find_lhs()

get_config(settings)

get_container(settings)

get_custom(settings)

get_input_types()

Returns python native types for inputs.

get_query(**kwargs)

get_type_for_input_var(k, v)

Returns the python native type for the given input variable # TODO we could use literal type to determine this

get_type_for_output_var(k, v)

Returns the python native type for the given output variable # TODO we could use literal type to determine this

interpolate_query(query_template, **kwargs)

This function will fill in the query template with the provided kwargs and return the interpolated query Please note that when SQL tasks run in Flyte, this step is done by the

post_execute(user_params, rval)

Post execute is called after the execution has completed, with the user_params and can be used to clean-up, or alter the outputs to match the intended tasks outputs.

pre_execute(user_params)

This is the method that will be invoked directly before executing the task method and before all the inputs are converted.

Attributes

environment

instantiated_in

interface

lhs

location

metadata

name

python_interface

query_template

security_context

task_config

task_type

task_type_version