Exemple #1
0
    def define_tables(cls, metadata):
        MutableSet = cls._type_fixture()

        mutable_pickle = MutableSet.as_mutable(PickleType)
        Table('foo', metadata,
              Column('id', Integer, primary_key=True,
                     test_needs_autoincrement=True),
              Column('skip', mutable_pickle),
              Column('data', mutable_pickle),
              Column('non_mutable_data', PickleType),
              Column('unrelated_data', String(50))
              )
Exemple #2
0
    def define_tables(cls, metadata):
        MutableSet = cls._type_fixture()

        mutable_pickle = MutableSet.as_mutable(PickleType)
        Table('foo', metadata,
              Column('id', Integer, primary_key=True,
                     test_needs_autoincrement=True),
              Column('skip', mutable_pickle),
              Column('data', mutable_pickle),
              Column('non_mutable_data', PickleType),
              Column('unrelated_data', String(50))
              )
Exemple #3
0
    def define_tables(cls, metadata):
        MutableSet = cls._type_fixture()

        mutable_pickle = MutableSet.as_mutable(PickleType)
        Table(
            "foo",
            metadata,
            Column(
                "id", Integer, primary_key=True, test_needs_autoincrement=True
            ),
            Column("skip", mutable_pickle),
            Column("data", mutable_pickle),
            Column("non_mutable_data", PickleType),
            Column("unrelated_data", String(50)),
        )
Exemple #4
0
    def define_tables(cls, metadata):
        MutableSet = cls._type_fixture()

        mutable_pickle = MutableSet.as_mutable(PickleType)
        Table(
            "foo",
            metadata,
            Column(
                "id", Integer, primary_key=True, test_needs_autoincrement=True
            ),
            Column("skip", mutable_pickle),
            Column("data", mutable_pickle),
            Column("non_mutable_data", PickleType),
            Column("unrelated_data", String(50)),
        )
Exemple #5
0
        assert all([self.separator not in v for v in value])

        return self.separator.join(value)

    def process_result_value(self, value, dialect):
        if not value or value == self.empty_indicator:
            return set()
        return set(map(self.type, value.split(self.separator)))

    def coerce_element(self, element):
        for value_type, attribute in self.coerce_rules.items():
            if isinstance(element, value_type):
                return getattr(element, attribute)
        return element

    def coerce_compared_value(self, op, value):
        return self.impl.coerce_compared_value(op, value)


MutableSet.associate_with(ScalarSet)


class MediumPickle(db.PickleType):

    impl = mysql.MEDIUMBLOB


@compiles(MediumPickle, 'sqlite')
def sqlite_utc_after(element, compiler, **kwargs):
    return compiler.visit_BLOB(element, **kwargs)