Beispiel #1
0
    def __init__(self, expr, order_by=None):
        self.expr = expression._literal_as_binds(expr)

        if order_by is not None:
            self.order_by = expression._literal_as_binds(order_by)
        else:
            self.order_by = None
Beispiel #2
0
    def __init__(self, expr, order_by=None):
        self.expr = expression._literal_as_binds(expr)

        if order_by is not None:
            self.order_by = expression._literal_as_binds(order_by)
        else:
            self.order_by = None
Beispiel #3
0
 def __init__(self, expr, separator, order_by=None): # pylint: disable=W0231
     self.expr = _literal_as_binds(expr)
     self.separator = _literal_as_binds(separator)
     if order_by is not None:
         self.order_by = _literal_as_column(order_by)
     else:
         self.order_by = None
Beispiel #4
0
 def __init__(self, expr, separator, order_by=None):  # pylint: disable=W0231
     self.expr = _literal_as_binds(expr)
     self.separator = _literal_as_binds(separator)
     if order_by is not None:
         self.order_by = _literal_as_column(order_by)
     else:
         self.order_by = None
Beispiel #5
0
 def __init__(self, level, id, label, metadata=None):
     self.level = level
     self.id = id
     self.label = label
     self.label_expression = cast(_literal_as_binds(self.label),
                                  types.Unicode)
     self.id_expr = _literal_as_binds(self.id)
     self.metadata = metadata or MetaData()
Beispiel #6
0
 def __init__(self, name='All', label='All', metadata=None):
     self.label = label
     self.name = name
     self.label_expression = cast(_literal_as_binds(self.label),
                                  types.Unicode)
     self.parent_level = None
     self.metadata = metadata or MetaData()
     self.column = None
     self._level_key = name
     self._level_label_key = label
Beispiel #7
0
 def __init__(self, left, right, operator=operators.eq):
     self.type = sqltypes.Boolean()
     self.left = expression._literal_as_binds(left)
     self.right = right
     self.operator = operator
Beispiel #8
0
 def __init__(self, expr):
     self.expr = expression._literal_as_binds(expr)
Beispiel #9
0
 def __call__(self, *args, **kwargs):
     args = [_literal_as_binds(c) for c in args]
     return type.__call__(self, *args, **kwargs)
Beispiel #10
0
    def __init__(self, expr):
        self.expr = expression._literal_as_binds(expr)


@compiles(array, 'postgresql')
Beispiel #11
0
    def process_result_value(self, value, dialect):
        return tuple(value)

    def is_mutable(self):
        return False


class array_agg(expression.ColumnElement):
    type = StaticArray()

    def __init__(self, expr, order_by=None):
        self.expr = expression._literal_as_binds(expr)

        if order_by is not None:
            self.order_by = expression._literal_as_binds(order_by)
        else:
            self.order_by = None


@compiles(array_agg, 'postgresql')
def _compile_array_agg_postgresql(element, compiler, **kw):
    buf = StringIO()
    buf.write('array(select x from unnest(array_agg(')
    buf.write(compiler.process(element.expr))
    if element.order_by is not None:
        buf.write(' ORDER BY ')
        buf.write(compiler.process(element.order_by))
    buf.write(')) x WHERE x IS NOT NULL)')
    return buf.getvalue()
Beispiel #12
0
 def __init__(self, left, right, operator=operators.eq):
     self.type = sqltypes.Boolean()
     self.left = expression._literal_as_binds(left)
     self.right = right
     self.operator = operator
Beispiel #13
0
 def __init__(self, expr):
     self.expr = expression._literal_as_binds(expr)
Beispiel #14
0
 def _as_selects(self, cuboid):
     col = _literal_as_binds(self.constant)
     col._is_agg = self.agg
     return [self._select_class(self, column_clause=col)]