astro.utils.table

Module Contents

Functions

_pull_first_table_from_parameters(parameters)

When trying to "magically" determine the context of a decorator, we will try to find the first table.

_pull_first_table_from_op_kwargs(op_kwargs, ...)

When trying to "magically" determine the context of a decorator, we will try to find the first table.

_find_first_table_from_op_args(op_args)

When trying to "magically" determine the context of a decorator, we will try to find the first table.

find_first_table(op_args, op_kwargs, python_callable, ...)

When we create our SQL operation, we run with the assumption that the first table given is the "main table".

astro.utils.table._pull_first_table_from_parameters(parameters)

When trying to “magically” determine the context of a decorator, we will try to find the first table. This function attempts this by checking parameters

Parameters

parameters (Dict) – a user-defined dictionary of parameters

Returns

the first parameter of type Table, if any. Return None otherwise.

Return type

Optional[astro.sql.table.Table]

astro.utils.table._pull_first_table_from_op_kwargs(op_kwargs, python_callable)

When trying to “magically” determine the context of a decorator, we will try to find the first table. This function attempts this by checking op_kwargs

Parameters
  • op_kwargs (Dict) – user-defined operator’s kwargs

  • python_callable (Callable) –

Returns

the first kwarg declared in the decorated method which is an instance of Table. Return None if non-existent

Return type

Optional[astro.sql.table.Table]

astro.utils.table._find_first_table_from_op_args(op_args)

When trying to “magically” determine the context of a decorator, we will try to find the first table. This function attempts this by checking op_args

Parameters

op_args (Tuple) – user-defined operator’s args

Returns

the first arg which is an instance of Table. If there are no instances, return None.

Return type

Optional[astro.sql.table.Table]

astro.utils.table.find_first_table(op_args, op_kwargs, python_callable, parameters)

When we create our SQL operation, we run with the assumption that the first table given is the “main table”. This means that a user doesn’t need to define default conn_id, database, etc. in the function unless they want to create default values.

Parameters
  • parameters (Dict) – user-defined parameters to be injected into SQL statement

  • op_args (Tuple) –

  • op_kwargs (Dict) –

  • python_callable (Callable) –

Returns

the first table declared as decorator arg or kwarg

Return type

Optional[astro.sql.table.Table]