def __str__(self): context = {} for key, querypart in self._queryparts.items(): is_set = getattr(querypart, 'is_set', True) if is_set: context[key] = ' ' + force_text(querypart) else: context[key] = '' return (self._query_template % context).strip()
def __unicode__(self): context = {} for key, querypart in six.iteritems(self._queryparts): is_set = getattr(querypart, 'is_set', True) if is_set: context[key] = ' ' + force_text(querypart) else: context[key] = '' return self._query_template % context
def __unicode__(self): context = {} for key, querypart in six.iteritems(self._queryparts): is_set = getattr(querypart, "is_set", True) if is_set: context[key] = " " + force_text(querypart) else: context[key] = "" return (self._query_template % context).strip()
def __str__(self): if self.alias: table = '{} AS {}'.format( SqlReference(self.table_name), SqlReference(self.alias), ) else: table = force_text(SqlReference(self.table_name)) if self._joins: self._minimize_joins() table += ' ' + ' '.join( '{} {}{}'.format( JOIN_TYPES[join['type']], join['table'], ' ON {}'.format(join['ons']) if join['ons'].is_set else '', ) for join in self._joins ) return table
def __unicode__(self): if self.alias: table = six.u('%s AS %s') % ( SqlReference(self.table_name), SqlReference(self.alias), ) else: table = force_text(SqlReference(self.table_name)) if self._joins: self._minimize_joins() table += six.u(' ') + six.u(' ').join( six.u('%s %s%s') % ( JOIN_TYPES[join['type']], join['table'], six.u(' ON %s') % join['ons'] if join['ons'].is_set else '', ) for join in self._joins ) return table
def __unicode__(self): if self.alias: table = six.u('%s AS %s') % ( SqlReference(self.table_name), SqlReference(self.alias), ) else: table = force_text(SqlReference(self.table_name)) if self._joins: self._minimize_joins() table += six.u(' ') + six.u(' ').join( six.u('%s %s%s') % ( JOIN_TYPES[join['type']], join['table'], six.u(' ON %s') % join['ons'] if join['ons'].is_set else '', ) for join in self._joins) return table
def has(self, value): return has(self, force_text(value).upper())
def __str__(self): return self._separator.join(force_text(f) for f in self)
def has(part, value): value = force_text(value) # If I look for example for "distinct", I don't want to say "hey, there is #+ distinct!", if there is actually "distinctrow". res = re.search(r'([^\w]|^){}([^\w]|$)'.format(value), str(part)) return bool(res)
def has(part, value): value = force_text(value) # If I look for example for "distinct", I don't want to say "hey, there is #+ distinct!", if there is actually "distinctrow". res = re.search('([^\w]|^)%s([^\w]|$)' % value, six.text_type(part)) return bool(res)
def __unicode__(self): return self._separator.join(force_text(f) for f in self)
def _get_expr_as_string(self): if isinstance(self.expr, (list, tuple)): return six.u(', ').join(force_text(SqlReference(e)) for e in self.expr) return SqlReference(self.expr)