Here are the examples of the python api sqlalchemy.types.VARBINARY taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
Project: alembic Source File: test_autogen_diffs.py
def test_typedec_to_nonstandard(self):
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 = self._fixture()
impl.compare_type(
Column('x', sqlite.NUMERIC(50)),
Column('x', PasswordType(50)))
3
Example 2
def load_dialect_impl(self, dialect):
if dialect.name == 'postgresql':
# Use a BYTEA type for postgresql.
impl = postgresql.BYTEA(self.length)
return dialect.type_descriptor(impl)
if dialect.name == 'oracle':
# Use a RAW type for oracle.
impl = oracle.RAW(self.length)
return dialect.type_descriptor(impl)
# Use a VARBINARY for all other dialects.
impl = types.VARBINARY(self.length)
return dialect.type_descriptor(impl)