Package gavo :: Package utils :: Module misctricks :: Class QuotedName
[frames] | no frames]

Class QuotedName

source code

object --+
         |
        QuotedName

A string-like thing basically representing SQL delimited identifiers.

This has some features that make handling these relatively painless in ADQL code.

The most horrible feature is that these hash and compare as their embedded names, except to other QuotedNamess.

SQL-92, in 5.2, roughly says:

delimited identifiers compare literally with each other, delimited identifiers compare with regular identifiers after the latter are all turned to upper case. But since postgres turns everything to lower case, we do so here, too.

>>> n1, n2, n3 = QuotedName("foo"), QuotedName('foo"l'), QuotedName("foo")
>>> n1==n2,n1==n3,hash(n1)==hash("foo")
(False, True, True)
>>> print n1, n2
"foo" "foo""l"
Instance Methods
 
__init__(self, name)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
__hash__(self)
hash(x)
source code
 
__eq__(self, other) source code
 
__ne__(self, other) source code
 
__str__(self)
str(x)
source code
 
__repr__(self)
repr(x)
source code
 
isRegularLower(self) source code
 
lower(self) source code
 
flatten(self) source code
 
capitalize(self) source code
 
__add__(self, other) source code
 
__providedBy__(...)
Object Specification Descriptor
source code
 
__provides__(...)
Special descriptor for class __provides__

Inherited from object: __delattr__, __format__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

Class Variables
  __implemented__ = <implementedBy gavo.utils.misctricks.QuotedN...
Properties

Inherited from object: __class__

Method Details

__init__(self, name)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: object.__hash__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__provides__(...)

 

Special descriptor for class __provides__

The descriptor caches the implementedBy info, so that we can get declarations for objects without instance-specific interfaces a bit quicker.


Class Variable Details

__implemented__

Value:
<implementedBy gavo.utils.misctricks.QuotedName>