def send(self) -> Tree: visitor = AbstractSyntaxTreeVisitor([]) wait_for(visitor.visit_child(self)) if self._to_json: r = wait_for(materialize_walk(visitor.root)) else: r = wait_for(materialize_walk_obj(visitor.root)) if not self._as_list and not self._as_dict: return r # r is a list of dicts, but static checkers don't know that r = next(itertools.islice(r[0].values(), 0, 1)) if self._as_dict: return {k: v for k, v in zip(self.get_keys(), r)} else: return r
def resolve_field(val): try: if callable(val): val = val() if iscoroutinefunction(val): return wait_for(val) else: return val except Exception as ex: log_exception() return None
def to_sql(self) -> str: visitor = SQLBuilderVisitor([]) wait_for(visitor.visit(self)) return visitor.sql
def dump(self) -> str: visitor = PrintASTVisitor([]) wait_for(visitor.visit(self)) return visitor.tree
def debug(self, indent=1): visitor = AbstractSyntaxTreeVisitor([]) wait_for(visitor.visit_child(self)) print_walk(visitor.root, indent)