本文整理汇总了Python中sqlalchemy.PickleType方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.PickleType方法的具体用法?Python sqlalchemy.PickleType怎么用?Python sqlalchemy.PickleType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy
的用法示例。
在下文中一共展示了sqlalchemy.PickleType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('task_result',
sa.Column('updated', sa.DateTime(), nullable=True),
sa.Column('created', sa.DateTime(), nullable=True),
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('pull_mirror_id', sa.Integer(), nullable=True),
sa.Column('push_mirror_id', sa.Integer(), nullable=True),
sa.Column('task_id', sa.String(length=155), nullable=True),
sa.Column('status', sa.String(length=50), nullable=True),
sa.Column('task_name', sa.String(length=255), nullable=True),
sa.Column('invoked_by', sa.Integer(), nullable=True),
sa.Column('result', sa.PickleType(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.Column('traceback', sa.Text(), nullable=True),
sa.ForeignKeyConstraint(['pull_mirror_id'], ['pull_mirror.id'], ),
sa.ForeignKeyConstraint(['push_mirror_id'], ['push_mirror.id'], ),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('task_id')
)
op.create_index(op.f('ix_task_result_pull_mirror_id'), 'task_result', ['pull_mirror_id'], unique=False)
op.create_index(op.f('ix_task_result_push_mirror_id'), 'task_result', ['push_mirror_id'], unique=False)
# ### end Alembic commands ###
示例2: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
op.create_table(
'opendaylightjournal',
sa.Column('id', sa.String(36), primary_key=True),
sa.Column('object_type', sa.String(36), nullable=False),
sa.Column('object_uuid', sa.String(36), nullable=False),
sa.Column('operation', sa.String(36), nullable=False),
sa.Column('data', sa.PickleType, nullable=True),
sa.Column('state',
sa.Enum('pending', 'processing', 'failed', 'completed',
name='state'),
nullable=False, default='pending'),
sa.Column('retry_count', sa.Integer, default=0),
sa.Column('created_at', sa.DateTime, default=sa.func.now()),
sa.Column('last_retried', sa.TIMESTAMP, server_default=sa.func.now(),
onupdate=sa.func.now())
)
开发者ID:openstack,项目名称:networking-odl,代码行数:19,代码来源:37e242787ae5_opendaylight_neutron_mechanism_driver_.py
示例3: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
op.create_table(
'opendaylightjournal_new',
sa.Column('seqnum', sa.BigInteger(),
primary_key=True, autoincrement=True),
sa.Column('object_type', sa.String(36), nullable=False),
sa.Column('object_uuid', sa.String(36), nullable=False),
sa.Column('operation', sa.String(36), nullable=False),
sa.Column('data', sa.PickleType, nullable=True),
sa.Column('state',
sa.Enum('pending', 'processing', 'failed', 'completed',
name='state'),
nullable=False, default='pending'),
sa.Column('retry_count', sa.Integer, default=0),
sa.Column('created_at', sa.DateTime, default=sa.func.now()),
sa.Column('last_retried', sa.TIMESTAMP, server_default=sa.func.now(),
onupdate=sa.func.now()),
)
示例4: test_custom_pickle
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def test_custom_pickle(self):
class MyPickleType(types.TypeDecorator):
impl = PickleType
def process_bind_param(self, value, dialect):
if value:
value.stuff = "BIND" + value.stuff
return value
def process_result_value(self, value, dialect):
if value:
value.stuff = value.stuff + "RESULT"
return value
data = pickleable.Foo("im foo 1")
expected = pickleable.Foo("im foo 1")
expected.stuff = "BINDim stuffRESULT"
self._test_round_trip(MyPickleType, data, expected=expected)
示例5: test_eq_comparison
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def test_eq_comparison(self):
p1 = PickleType()
for obj in (
{"1": "2"},
pickleable.Bar(5, 6),
pickleable.OldSchool(10, 11),
):
assert p1.compare_values(p1.copy_value(obj), obj)
assert_raises(
NotImplementedError,
p1.compare_values,
pickleable.BrokenComparable("foo"),
pickleable.BrokenComparable("foo"),
)
示例6: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('celery_taskmeta',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('task_id', sa.String(length=155), nullable=True),
sa.Column('status', sa.String(length=50), nullable=True),
sa.Column('result', sa.PickleType(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.Column('traceback', sa.Text(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('task_id'),
sqlite_autoincrement=True
)
op.create_table('celery_tasksetmeta',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('taskset_id', sa.String(length=155), nullable=True),
sa.Column('result', sa.PickleType(), nullable=True),
sa.Column('date_done', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id'),
sa.UniqueConstraint('taskset_id'),
sqlite_autoincrement=True
)
op.add_column('task_result', sa.Column('celery_taskmeta_id', sa.Integer(), nullable=False))
op.create_index(op.f('ix_task_result_celery_taskmeta_id'), 'task_result', ['celery_taskmeta_id'], unique=False)
op.drop_constraint('task_result_task_id_key', 'task_result', type_='unique')
op.create_foreign_key(None, 'task_result', 'celery_taskmeta', ['celery_taskmeta_id'], ['id'])
op.drop_column('task_result', 'result')
op.drop_column('task_result', 'status')
op.drop_column('task_result', 'date_done')
op.drop_column('task_result', 'task_id')
op.drop_column('task_result', 'traceback')
# ### end Alembic commands ###
示例7: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
op.add_column('listener', sa.Column('insert_headers', sa.PickleType()))
示例8: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade(): # noqa: D103
op.add_column('dag_run', sa.Column('conf', sa.PickleType(), nullable=True))
示例9: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade(): # noqa: D103
op.add_column(TASK_INSTANCE_TABLE, sa.Column(NEW_COLUMN, sa.PickleType(pickler=dill)))
示例10: downgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def downgrade(): # noqa: D103
# use batch_alter_table to support SQLite workaround
with op.batch_alter_table("xcom") as batch_op:
batch_op.alter_column('value', type_=sa.PickleType(pickler=dill))
示例11: _define_start_params_table
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def _define_start_params_table(database):
start_params_table = Table(
"start_params", database, Column("value", PickleType), extend_existing=True
)
return start_params_table
示例12: _define_one_column_pickle_table
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def _define_one_column_pickle_table(database, table):
params_table = Table(
table,
database,
Column("iteration", Integer, primary_key=True),
Column("value", PickleType),
sqlite_autoincrement=True,
extend_existing=True,
)
return params_table
示例13: _define_scalar_pickle_table
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def _define_scalar_pickle_table(database, name):
dash_options = Table(
name, database, Column("value", PickleType), extend_existing=True
)
return dash_options
示例14: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"task_results",
sa.Column("task_id", sa.String(), nullable=False),
sa.Column("jobs", sa.PickleType(), nullable=True),
sa.Column("event", sa.PickleType(), nullable=True),
sa.PrimaryKeyConstraint("task_id"),
)
op.drop_column("copr_builds", "logs")
# ### end Alembic commands ###
示例15: upgrade
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import PickleType [as 别名]
def upgrade():
op.add_column('division',
sa.Column('pilot_transformer', sa.PickleType(), nullable=True))
op.add_column('division',
sa.Column('ship_transformer', sa.PickleType(), nullable=True))
op.drop_column('request', 'ship_url')