def reference(cls, value): """ Convert as reference on column. table => "table" table.column => "table"."column" db.table.column => "db"."table"."column" table."col.umn" => "table"."col.umn" "table"."col.umn" => "table"."col.umn" """ from sqlpuzzle._common.utils import force_text value = force_text(value) parts = re.split('%(quote)s([^%(quote)s]+)%(quote)s|\.' % {'quote': cls._reference_quote}, value) parts = (six.u('%(quote)s%(i)s%(quote)s') % {'quote': cls._reference_quote, 'i': i} if i != '*' else i for i in parts if i) return six.u('.').join(parts)
def reference(cls, value): """ Convert as reference on column. table => "table" table.column => "table"."column" db.table.column => "db"."table"."column" table."col.umn" => "table"."col.umn" "table"."col.umn" => "table"."col.umn" """ from sqlpuzzle._common.utils import force_text value = force_text(value) parts = re.split(r'{quote}([^{quote}]+){quote}|\.'.format(quote=cls.reference_quote), value) parts = ('{quote}{i}{quote}'.format(quote=cls.reference_quote, i=i) if i != '*' else i for i in parts if i) return '.'.join(parts)
def reference(cls, value): """ Convert as reference on column. table => "table" table.column => "table"."column" db.table.column => "db"."table"."column" table."col.umn" => "table"."col.umn" "table"."col.umn" => "table"."col.umn" """ from sqlpuzzle._common.utils import force_text value = force_text(value) parts = re.split( '%(quote)s([^%(quote)s]+)%(quote)s|\.' % {'quote': cls._reference_quote}, value) parts = (six.u('%(quote)s%(i)s%(quote)s') % { 'quote': cls._reference_quote, 'i': i } if i != '*' else i for i in parts if i) return six.u('.').join(parts)
def __str__(self): return '"{} {}"'.format( self._string_representation, force_text(self._value), )
def __str__(self): return '"%s %s"' % ( self._string_representation, force_text(self._value), )