Python sqlalchemy.types.SchemaType() Examples

The following are 6 code examples of sqlalchemy.types.SchemaType(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sqlalchemy.types , or try the search function .
Example #1
Source File: sqla_compat.py    From jbox with MIT License 5 votes vote down vote up
def _is_type_bound(constraint):
    # this deals with SQLAlchemy #3260, don't copy CHECK constraints
    # that will be generated by the type.
    if sqla_100:
        # new feature added for #3260
        return constraint._type_bound
    else:
        # old way, look at what we know Boolean/Enum to use
        return (
            constraint._create_rule is not None and
            isinstance(
                getattr(constraint._create_rule, "target", None),
                sqltypes.SchemaType)
        ) 
Example #2
Source File: test_metadata.py    From sqlalchemy with MIT License 5 votes vote down vote up
def __init__(self):
            TypeDecorator.__init__(self)
            sqltypes.SchemaType.__init__(self) 
Example #3
Source File: test_metadata.py    From sqlalchemy with MIT License 5 votes vote down vote up
def test_before_parent_attach_typedec_enclosing_schematype(self):
        # additional test for [ticket:2919] as part of test for
        # [ticket:3832]

        class MySchemaType(sqltypes.TypeEngine, sqltypes.SchemaType):
            pass

        target_typ = MySchemaType()

        class MyType(TypeDecorator):
            impl = target_typ

        typ = MyType()
        self._test_before_parent_attach(typ, target_typ, double=True) 
Example #4
Source File: test_metadata.py    From sqlalchemy with MIT License 5 votes vote down vote up
def test_before_parent_attach_typedec_of_schematype(self):
        class MyType(TypeDecorator, sqltypes.SchemaType):
            impl = String

        typ = MyType()
        self._test_before_parent_attach(typ) 
Example #5
Source File: test_metadata.py    From sqlalchemy with MIT License 5 votes vote down vote up
def test_before_parent_attach_schematype_of_typedec(self):
        class MyType(sqltypes.SchemaType, TypeDecorator):
            impl = String

        typ = MyType()
        self._test_before_parent_attach(typ) 
Example #6
Source File: sqla_compat.py    From android_universal with MIT License 5 votes vote down vote up
def _is_type_bound(constraint):
    # this deals with SQLAlchemy #3260, don't copy CHECK constraints
    # that will be generated by the type.
    if sqla_100:
        # new feature added for #3260
        return constraint._type_bound
    else:
        # old way, look at what we know Boolean/Enum to use
        return (
            constraint._create_rule is not None and
            isinstance(
                getattr(constraint._create_rule, "target", None),
                sqltypes.SchemaType)
        )