gws.lib.cql.builder

Build database expressions from CQL2 parse trees.

Builder only dispatches on node types, SqlBuilder generates SQLAlchemy expressions for postgis. See the package documentation for details.

Source code: gws.lib.cql.builder

Module Contents

class gws.lib.cql.builder.Builder
build(e)

Build an expression from a parse tree node.

build_function(args)

Build a standard function call, dispatching on the function name.

build_operator(op, args)

Build a binary operator expression.

build_user_function(args)

Build a non-standard function call. Subclasses handle their own functions here.

get_method(name)

Return a handler method, or None if the subclass doesn’t implement it.

value(e) Any

Unwrap a literal node into a plain python value.

exception gws.lib.cql.builder.BuildError

Common base class for all non-exit exceptions.

class gws.lib.cql.builder.SqlBuilder(table: gws.lib.sa.Table)
table
array_element_type(vals)

Infer the element type of an array literal from its first element.

array_operand(e)

Build an array expression, an array literal becoming a typed parameter.

array_pair(args)

Coerce both operands of an array predicate to arrays.

build_and(args)
build_array(args)
build_bbox(args)
build_between(args)
build_bool(args)
build_date(args)
build_float(args)
build_in(args)
build_int(args)
build_is_null(args)
build_like(args)
build_name(args)
build_not(args)
build_not_between(args)
build_not_in(args)
build_not_like(args)
build_not_null(args)
build_operator(op, args)

Build a binary operator expression.

build_or(args)
build_string(args)
build_timestamp(args)
build_wkt(args)
func_a_containedby(args)
func_a_contains(args)
func_a_equals(args)
func_a_overlaps(args)
func_accenti(args)
func_bbox(args)
func_casei(args)
func_date(args)
func_interval(args)
func_s_contains(args)
func_s_crosses(args)
func_s_disjoint(args)
func_s_equals(args)
func_s_intersects(args)
func_s_overlaps(args)
func_s_touches(args)
func_s_within(args)
func_t_after(args)
func_t_before(args)
func_t_contains(args)
func_t_disjoint(args)
func_t_during(args)
func_t_equals(args)
func_t_finishedby(args)
func_t_finishes(args)
func_t_intersects(args)
func_t_meets(args)
func_t_metby(args)
func_t_overlappedby(args)
func_t_overlaps(args)
func_t_startedby(args)
func_t_starts(args)
func_timestamp(args)
literal(val)

Wrap a python value as a bound parameter.

temporal_bound(e, unbounded)

Build an interval bound, the string '..' meaning open.

temporal_pair(args)

Coerce both operands of a temporal predicate to ranges.

temporal_range(e)

Coerce a temporal expression to a tstzrange, an instant becomes a degenerate range.

A null bound is unbounded in postgres, therefore null inputs must yield a null range, otherwise a null column would match everything.

timestamp_value(e)

Coerce an expression to a timestamptz, naive values are assumed to be UTC.