class documentation

class conv(_truncated_label):

View In Hierarchy

Mark a string indicating that a name has already been converted by a naming convention.

This is a string subclass that indicates a name that should not be subject to any further naming conventions.

E.g. when we create a .Constraint using a naming convention as follows:

m = MetaData(naming_convention={
    "ck": "ck_%(table_name)s_%(constraint_name)s"
})
t = Table('t', m, Column('x', Integer),
                CheckConstraint('x > 5', name='x5'))

The name of the above constraint will be rendered as "ck_t_x5". That is, the existing name x5 is used in the naming convention as the constraint_name token.

In some situations, such as in migration scripts, we may be rendering the above .CheckConstraint with a name that's already been converted. In order to make sure the name isn't double-modified, the new name is applied using the _schema.conv marker. We can use this explicitly as follows:

m = MetaData(naming_convention={
    "ck": "ck_%(table_name)s_%(constraint_name)s"
})
t = Table('t', m, Column('x', Integer),
                CheckConstraint('x > 5', name=conv('ck_t_x5')))

Where above, the _schema.conv marker indicates that the constraint name here is final, and the name will render as "ck_t_x5" and not "ck_t_ck_t_x5"

New in version 0.9.4.
Class Variable __slots__ Undocumented

Inherited from _truncated_label:

Method __new__ Undocumented
Method __reduce__ Undocumented
Method apply​_map Undocumented

Inherited from quoted_name (via _truncated_label):

Instance Variable quote Undocumented
Method __repr__ Undocumented
Method ​_memoized​_method​_lower Undocumented
Method ​_memoized​_method​_upper Undocumented

Inherited from MemoizedSlots (via _truncated_label, quoted_name):

Method __getattr__ Undocumented
Method ​_fallback​_getattr Undocumented
__slots__: tuple =