本文整理汇总了Python中sqlalchemy.dialects.postgresql.BYTEA属性的典型用法代码示例。如果您正苦于以下问题:Python postgresql.BYTEA属性的具体用法?Python postgresql.BYTEA怎么用?Python postgresql.BYTEA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sqlalchemy.dialects.postgresql
的用法示例。
在下文中一共展示了postgresql.BYTEA属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_postgresql_hstore_subtypes
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def test_postgresql_hstore_subtypes(self):
eq_ignore_whitespace(
autogenerate.render._repr_type(HSTORE(), self.autogen_context),
"postgresql.HSTORE(text_type=sa.Text())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
HSTORE(text_type=String()), self.autogen_context
),
"postgresql.HSTORE(text_type=sa.String())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
HSTORE(text_type=BYTEA()), self.autogen_context
),
"postgresql.HSTORE(text_type=postgresql.BYTEA())",
)
assert (
"from sqlalchemy.dialects import postgresql"
in self.autogen_context.imports
)
示例2: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task_result', sa.Column('traceback', sa.TEXT(), autoincrement=False, nullable=True))
op.add_column('task_result', sa.Column('task_id', sa.VARCHAR(length=155), autoincrement=False, nullable=True))
op.add_column('task_result', sa.Column('date_done', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
op.add_column('task_result', sa.Column('status', sa.VARCHAR(length=50), autoincrement=False, nullable=True))
op.add_column('task_result', sa.Column('result', postgresql.BYTEA(), autoincrement=False, nullable=True))
op.drop_constraint(None, 'task_result', type_='foreignkey')
op.create_unique_constraint('task_result_task_id_key', 'task_result', ['task_id'])
op.drop_index(op.f('ix_task_result_celery_taskmeta_id'), table_name='task_result')
op.drop_column('task_result', 'celery_taskmeta_id')
op.drop_table('celery_tasksetmeta')
op.drop_table('celery_taskmeta')
# ### end Alembic commands ###
示例3: test_postgresql_array_type
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def test_postgresql_array_type(self):
eq_ignore_whitespace(
autogenerate.render._repr_type(
ARRAY(Integer), self.autogen_context
),
"postgresql.ARRAY(sa.Integer())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
ARRAY(DateTime(timezone=True)), self.autogen_context
),
"postgresql.ARRAY(sa.DateTime(timezone=True))",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
ARRAY(BYTEA, as_tuple=True, dimensions=2), self.autogen_context
),
"postgresql.ARRAY(postgresql.BYTEA(), "
"as_tuple=True, dimensions=2)",
)
assert (
"from sqlalchemy.dialects import postgresql"
in self.autogen_context.imports
)
示例4: test_generic_array_type
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def test_generic_array_type(self):
eq_ignore_whitespace(
autogenerate.render._repr_type(
types.ARRAY(Integer), self.autogen_context
),
"sa.ARRAY(sa.Integer())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
types.ARRAY(DateTime(timezone=True)), self.autogen_context
),
"sa.ARRAY(sa.DateTime(timezone=True))",
)
assert (
"from sqlalchemy.dialects import postgresql"
not in self.autogen_context.imports
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
types.ARRAY(BYTEA, as_tuple=True, dimensions=2),
self.autogen_context,
),
"sa.ARRAY(postgresql.BYTEA(), as_tuple=True, dimensions=2)",
)
assert (
"from sqlalchemy.dialects import postgresql"
in self.autogen_context.imports
)
示例5: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('kv_store',
sa.Column('key', sa.VARCHAR(length=250), autoincrement=False, nullable=False),
sa.Column('value', postgresql.BYTEA(), autoincrement=False, nullable=False),
sa.PrimaryKeyConstraint('key', name='kv_store_pkey')
)
# ### end Alembic commands ###
示例6: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def upgrade():
op.alter_column('archive', 'ar_sha1',
existing_type=postgresql.BYTEA(),
nullable=True,
server_default=None,
existing_server_default=sa.text("'\\x'::bytea"))
op.alter_column('revision', 'rev_sha1',
existing_type=postgresql.BYTEA(),
nullable=True,
server_default=None,
existing_server_default=sa.text("'\\x'::bytea"))
# create ad-hoc tables for data migration
archive = sa.sql.table("archive",
sa.Column("ar_sha1", postgresql.BYTEA())
# other columns not needed for the data migration
)
revision = sa.sql.table("revision",
sa.Column("rev_sha1", postgresql.BYTEA())
# other columns not needed for the data migration
)
# migrate empty data to NULL
op.execute(
archive.update().where(archive.c.ar_sha1 == b"").values({"ar_sha1": None})
)
op.execute(
revision.update().where(revision.c.rev_sha1 == b"").values({"rev_sha1": None})
)
示例7: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# create ad-hoc tables for data migration
archive = sa.sql.table("archive",
sa.Column("ar_sha1", postgresql.BYTEA())
# other columns not needed for the data migration
)
revision = sa.sql.table("revision",
sa.Column("rev_sha1", postgresql.BYTEA())
# other columns not needed for the data migration
)
# migrate NULL values to empty data
op.execute(
archive.update().where(archive.c.ar_sha1 == None).values({"ar_sha1": b""})
)
op.execute(
revision.update().where(revision.c.rev_sha1 == None).values({"rev_sha1": b""})
)
op.alter_column('revision', 'rev_sha1',
existing_type=postgresql.BYTEA(),
nullable=False,
server_default=sa.text("'\\x'::bytea"),
existing_server_default=None)
op.alter_column('archive', 'ar_sha1',
existing_type=postgresql.BYTEA(),
nullable=False,
server_default=sa.text("'\\x'::bytea"),
existing_server_default=None)
示例8: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('node', sa.Column('modules_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('skin_id', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('type', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('target', sa.VARCHAR(length=80), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('custom', postgresql.BYTEA(), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('folder', sa.INTEGER(), server_default=sa.text('0'), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('image', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('folderid', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('parentid', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('node', sa.Column('mods', sa.INTEGER(), autoincrement=False, nullable=True))
op.rename_table('page', 'node')
op.execute('ALTER SEQUENCE page_id_seq RENAME TO node_id_seq')
op.create_table('modules',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('name', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='modules_pkey')
)
op.create_table('skin',
sa.Column('id', sa.INTEGER(), nullable=False),
sa.Column('title', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
sa.Column('fname', sa.VARCHAR(length=80), autoincrement=False, nullable=True),
sa.Column('orders', sa.INTEGER(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint('id', name='skin_pkey')
)
# ### end Alembic commands ###
示例9: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"collection", "group", existing_type=sa.VARCHAR(), type_=sa.String(length=100), existing_nullable=False
)
op.alter_column("molecule", "geometry", existing_type=postgresql.BYTEA(), nullable=False)
op.alter_column("molecule", "symbols", existing_type=postgresql.BYTEA(), nullable=False)
op.alter_column("task_queue", "spec", existing_type=postgresql.BYTEA(), nullable=False)
op.drop_constraint("task_queue_manager_fkey", "task_queue", type_="foreignkey")
op.create_foreign_key(
"task_queue_manager_fkey", "task_queue", "queue_manager", ["manager"], ["name"], ondelete="SET NULL"
)
# ### end Alembic commands ###
示例10: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint("task_queue_manager_fkey", "task_queue", type_="foreignkey")
op.create_foreign_key("task_queue_manager_fkey", "task_queue", "queue_manager", ["manager"], ["name"])
op.alter_column("task_queue", "spec", existing_type=postgresql.BYTEA(), nullable=True)
op.alter_column("molecule", "symbols", existing_type=postgresql.BYTEA(), nullable=True)
op.alter_column("molecule", "geometry", existing_type=postgresql.BYTEA(), nullable=True)
op.alter_column(
"collection", "group", existing_type=sa.String(length=100), type_=sa.VARCHAR(), existing_nullable=False
)
# ### end Alembic commands ###
示例11: upgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"slack_installation",
"access_token",
existing_type=postgresql.BYTEA(),
nullable=False,
)
op.alter_column(
"slack_installation",
"authorizing_user_id",
existing_type=sa.VARCHAR(length=300),
nullable=False,
)
op.alter_column(
"slack_installation",
"bot_access_token",
existing_type=postgresql.BYTEA(),
nullable=False,
)
op.alter_column(
"slack_installation",
"bot_user_id",
existing_type=postgresql.BYTEA(),
nullable=False,
)
op.alter_column(
"slack_installation",
"scope",
existing_type=sa.VARCHAR(length=300),
nullable=False,
)
op.alter_column(
"slack_installation",
"workspace_id",
existing_type=sa.VARCHAR(length=20),
nullable=False,
)
op.alter_column(
"slack_installation",
"workspace_name",
existing_type=sa.VARCHAR(length=255),
nullable=False,
)
# ### end Alembic commands ###
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:47,代码来源:20190624_02-33-30__make_slack_installation_cols_non_.py
示例12: downgrade
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import BYTEA [as 别名]
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column(
"slack_installation",
"workspace_name",
existing_type=sa.VARCHAR(length=255),
nullable=True,
)
op.alter_column(
"slack_installation",
"workspace_id",
existing_type=sa.VARCHAR(length=20),
nullable=True,
)
op.alter_column(
"slack_installation",
"scope",
existing_type=sa.VARCHAR(length=300),
nullable=True,
)
op.alter_column(
"slack_installation",
"bot_user_id",
existing_type=postgresql.BYTEA(),
nullable=True,
)
op.alter_column(
"slack_installation",
"bot_access_token",
existing_type=postgresql.BYTEA(),
nullable=True,
)
op.alter_column(
"slack_installation",
"authorizing_user_id",
existing_type=sa.VARCHAR(length=300),
nullable=True,
)
op.alter_column(
"slack_installation",
"access_token",
existing_type=postgresql.BYTEA(),
nullable=True,
)
# ### end Alembic commands ###
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:47,代码来源:20190624_02-33-30__make_slack_installation_cols_non_.py