Ejemplo n.º 1
0
    def test_typedec_to_nonstandard(self, impl_fixture):
        class PasswordType(TypeDecorator):
            impl = VARBINARY

            def copy(self, **kw):
                return PasswordType(self.impl.length)

            def load_dialect_impl(self, dialect):
                if dialect.name == "default":
                    impl = sqlite.NUMERIC(self.length)
                else:
                    impl = VARBINARY(self.length)
                return dialect.type_descriptor(impl)

        impl_fixture.compare_type(Column("x", sqlite.NUMERIC(50)),
                                  Column("x", PasswordType(50)))
Ejemplo n.º 2
0
 def load_dialect_impl(self, dialect):
     if dialect.name == 'default':
         impl = sqlite.NUMERIC(self.length)
     else:
         impl = VARBINARY(self.length)
     return dialect.type_descriptor(impl)