本文整理匯總了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