def to_bq(self, schema, not_null=False, boolean=False): if not self.terms: return TRUE.to_bq(schema) return BQLScript( expr=JoinSQL(SQL_AND, [self.lang[t].to_bq(schema) for t in self.terms if t != None]), data_type=BOOLEAN, frum=self, miss=FALSE, schema=schema, )
def to_bq(self, schema, not_null=False, boolean=False): term = BQLang[self.term].partial_eval() if term.type == "boolean": sql = term.to_bq(schema) return sql elif is_literal(term) and term.value in ("T", "F"): if term.value == "T": return TRUE.to_bq(schema) else: return FALSE.to_bq(schema) else: sql = term.exists().partial_eval().to_bq(schema) return sql