def _op_call(self, name, op, *args, **kw): akw = self._akw if self._field or name not in akw.op_map: return self.__super._op_call(name, op, *args, **kw) else: cidr_op = akw.op_map[name] op_proxy = _QX_Call_Proxy_(self, akw, name, cidr_op(akw)) return QX.Call(self, name, op_proxy, *args, **kw)
def _op_bin(self, rhs, name, op, reverse): akw = self._akw if self._field or name not in akw.op_map: return self.__super._op_bin(rhs, name, op, reverse) else: cidr_op = akw.op_map[name] op_proxy = _QX_Bin_Proxy_(self, akw, name, cidr_op(akw)) return QX.Bin(self, name, op_proxy, rhs, reverse)
def _op_call (self, name, op, * args, ** kw) : akw = self._akw if name not in akw.op_map : return self.__super._op_call (name, op, * args, ** kw) else : op_getter = akw.op_map [name] op_name = op_getter (akw) op_proxy = _QX_Call_Proxy_ (self, akw, name, op_name) result = QX.Call (self, name, op_proxy, * args, ** kw) return result
def _op_bin (self, rhs, name, op, reverse) : akw = self._akw if name not in akw.op_map : return self.__super._op_bin (rhs, name, op, reverse) else : op_getter = akw.op_map [name] op_name = op_getter (akw) op_proxy = _QX_Bin_Proxy_ (self, akw, name, op_name) result = QX.Bin (self, name, op_proxy, rhs, reverse) return result
def show_joins(apt, ET, q): qr = apt.DBW.PNS.Q_Result.E_Type(apt[ET], _strict=False) qx = QX.Mapper(qr)(q) try: qx.XS_FILTER ### might trigger additional joins except Exception: pass print(ET, " : ", q) for j in qx.JOINS: print \ ( " ", "%-5.5s" % j.joiner.__name__.upper () , " = ".join (str (c) for c in j.cols) )
def _get_xs (self, criteria, sa_query, xs_name, adder) : QX = self.QX joined = self._joined join = orig_join = sa_query.froms [-1] xs = [] for c in criteria : if isinstance (c, SA.Operators) : xs.append (c) elif c is not None : qx = QX.Mapper (self) (c) x = getattr (qx, xs_name) join = self._extend_join (join, joined, qx.JOINS) adder (xs, x) return xs, None if join is orig_join else join
def show_xs_filter(apt, ET, q): qr = apt.DBW.PNS.Q_Result.E_Type(apt[ET], _strict=False) qx = QX.Mapper(qr)(q) print(ET, " : ", q) print(" ", qx.XS_FILTER)
def show_qx(qx, level=0): print(QX.display(qx, level=0))
def show_columns(apt, ET, q): qr = apt.DBW.PNS.Q_Result.E_Type(apt[ET], _strict=False) qx = QX.Mapper(qr)(q) print("QX." + qx.__class__.__name__, ET, " : ", q) for c in qx._columns: print(" ", c)
def show_qx (qx, level = 0) : print (QX.display (qx, level = 0))