QueryBuilder Classes

class neoalchemy.cypher.CypherVerb

Parent class to Create and Match.

params

A dict mapping query parameter names to their current values.

__str__()

Return the underlying Cypher query, which has been automatically parametrized.

delete(args=None, detach=False)

Set the DELETE clause for the query.

Parameters:
  • args – See the docs for Return.
  • detach (bool) – If set, DETACH DELETE instead.
Returns:

The object itself, to support Chaining.

limit(n)

Set the LIMIT clause for the query.

Parameters:n (int) – The argument to LIMIT
order_by(args, desc=False)

Set the ORDER BY clause for the query.

Parameters:
  • args – See the docs for Return.
  • desc (bool) – If set, sort DESC. Otherwise, sort ASC.
remove(args=None)

Set the REMOVE clause for the query.

Parameters:args – See the docs for Return.
Returns:The object itself, to support Chaining.
return_(args=None, distinct=False)

Set the RETURN clause for the query.

Parameters:
  • args – See the docs for Return.
  • distinct (bool) – If set, RETURN DISTINCT instead.
Returns:

The object itself, to support Chaining.

set(property, value, var='n')

Set a property to a value. Can be called multiple times.

Parameters:
  • property (Property) – The property to set
  • value (any) – The value of the property to set
  • var (str) – The variable representing the node in Cypher.
Returns:

The object itself, to support Chaining.

skip(n)

Set the SKIP clause for the query.

Parameters:n (int) – The argument to SKIP
where(expr, var='n', or_=False)

Set the WHERE clause for the query.

Parameters:
  • expr (CypherExpression) – See the docs for Where
  • var (str) – The variable representing the node in Cypher.
  • or_ (bool) – If set, this will be joined with the preceding WHERE clause using OR instead of AND.
Returns:

The object itself, to support Chaining.

class neoalchemy.cypher.Create(nodetype, var='n', unique=False, **params)
Parameters:
  • nodetype (NodeType) – The NodeType used to construct the query.
  • var (str) – The variable representing the node in Cypher.
  • unique (bool) – If set, CREATE UNIQUE instead.
class neoalchemy.cypher.Match(nodetype, var='n', optional=False, **params)
Parameters:
  • nodetype (NodeType) – The NodeType used to construct the query.
  • var (str) – The variable representing the node in Cypher.
  • optional (bool) – If set, OPTIONAL MATCH instead.