當前位置: 首頁>>代碼示例>>Python>>正文


Python postgresql.BYTEA屬性代碼示例

本文整理匯總了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
        ) 
開發者ID:sqlalchemy,項目名稱:alembic,代碼行數:26,代碼來源:test_postgresql.py

示例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 ### 
開發者ID:Salamek,項目名稱:gitlab-tools,代碼行數:16,代碼來源:d4841aeeb072_.py

示例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
        ) 
開發者ID:sqlalchemy,項目名稱:alembic,代碼行數:30,代碼來源:test_postgresql.py

示例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
        ) 
開發者ID:sqlalchemy,項目名稱:alembic,代碼行數:35,代碼來源:test_postgresql.py

示例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 ### 
開發者ID:busy-beaver-dev,項目名稱:busy-beaver,代碼行數:10,代碼來源:20190302_15-02-04__remove_simplekv_store.py

示例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})
    ) 
開發者ID:lahwaacz,項目名稱:wiki-scripts,代碼行數:31,代碼來源:2d3b166fe612_make_sha1_columns_nullable.py

示例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) 
開發者ID:lahwaacz,項目名稱:wiki-scripts,代碼行數:31,代碼來源:2d3b166fe612_make_sha1_columns_nullable.py

示例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 ### 
開發者ID:pygame,項目名稱:pygameweb,代碼行數:32,代碼來源:6cb6a6a151b7_removed_unused_page_tables_and_fields.py

示例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 ### 
開發者ID:MolSSI,項目名稱:QCFractal,代碼行數:15,代碼來源:4b27843a188a_v12_final.py

示例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 ### 
開發者ID:MolSSI,項目名稱:QCFractal,代碼行數:13,代碼來源:4b27843a188a_v12_final.py

示例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


注:本文中的sqlalchemy.dialects.postgresql.BYTEA屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。