cymple.builder.CaseWhen

class cymple.builder.CaseWhen(query)

Bases: Query

A class for representing a “CASE WHEN” clause.

__init__(query)

Initialize the query object.

Methods

__init__(query)

Initialize the query object.

case_when(filters, on_true, on_false, ref_name)

Concatenate a CASE WHEN clause to the query, created from a list of given property filters.

cypher(cypher_query_str)

Concatenate a cypher query string

get()

Get the final query string .

case_when(filters: dict, on_true: str, on_false: str, ref_name: str, comparison_operator: str = '=', boolean_operator: str = 'AND', **kwargs)

Concatenate a CASE WHEN clause to the query, created from a list of given property filters.

Parameters:
  • filters (dict) – A dict representing the set of properties to be filtered

  • on_true (str) – The query to run when the predicate is true

  • on_false (str) – The query to run when the predicate is false

  • ref_name (str) – The name which is used to refer to the newly filtered object

  • comparison_operator (str) – A string operator, according to which the comparison between property values is done, e.g. for “=”, we get: property.name = property.value, defaults to “=”

  • boolean_operator (str) – The boolean operator to apply between predicates, defaults to “AND”

  • **kwargs

    kwargs

:type **kwargs

Returns:

A Query object with a query that contains the new clause.

Return type:

CaseWhenAvailable

cypher(cypher_query_str)

Concatenate a cypher query string

get()

Get the final query string .