def handle_redshift_statement_invocation()

in lambda/python/rs_integration_function/index.py [0:0]


def handle_redshift_statement_invocation(sql_statement: str, callback_object: CallbackInterface, run_as_singleton=False):
    if run_as_singleton and is_statement_in_active_state(sql_statement):
        raise ConcurrentExecution(f"There is already an instance of {sql_statement} running.")
    statement_name = ddb_sfn_state_table.register_execution_start(callback_object, sql_statement)
    with_event = not isinstance(callback_object, NoCallback)
    if not with_event:
        logger.debug(f'No callback for {sql_statement}')
    response = execute_statement(sql_statement, str(statement_name), with_event=with_event)
    logger.info({
        l_response: response,
        l_callback_object: callback_object
    })
    return response