Engine

Engine object SnowKillEngine accepts Snowflake connection, performs REST API calls and checks conditions.


__init__()

Arguments:

  • connection (SnowflakeConnection)

  • max_workers (int) - number of thread workers, which are primarily used to read query plans in parallel (default: 8)


check_and_kill_pending_queries()

Accept list of conditions, get information about running, blocked and queued queries, perform checks, kill queries, return matching queries.

Arguments:

  • conditions (List[AbstractQueryCondition])

Returns:


get_pending_queries()

Get information about running, blocked and queued queries. Return merged dict of queries. Useful for debugging and for creating your own custom automation.

Arguments:

  • blocked (bool) - add BLOCKED queries to result

  • queued (bool) - add QUEUED queries to result

  • running (bool) - add RUNNING queries to result

Returns:

  • Dict[str, Query] - key is query_id


get_query_by_id()

Get information about one specific query (in any status). If query was not found, returns None. It is very useful for debugging and development of new conditions and formatters.

  • query_id (str) - UUID of query

Returns:


get_query_plan()

Get information about one specific query plan. Query can be in any status. If plan is not available, raises an exception.

  • query_id (str) - UUID of query

Returns:


get_holding_locks()

Get information about all queries blocked by holding locks on account.

Returns:

Last updated