当前位置: 首页>>代码示例>>Python>>正文


Python sqlalchemy.false方法代码示例

本文整理汇总了Python中sqlalchemy.false方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.false方法的具体用法?Python sqlalchemy.false怎么用?Python sqlalchemy.false使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sqlalchemy的用法示例。


在下文中一共展示了sqlalchemy.false方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('contact',
    sa.Column('user', sa.String(length=255), nullable=False),
    sa.Column('contact', sa.String(length=255), nullable=False),
    sa.Column('in_community', sa.Boolean(), server_default=sa.false(), nullable=False),
    sa.ForeignKeyConstraint(['contact'], ['puppet.fbid'], ),
    sa.PrimaryKeyConstraint('user', 'contact')
    )
    op.create_table('user_portal',
    sa.Column('user', sa.String(length=255), nullable=False),
    sa.Column('portal', sa.String(length=255), nullable=False),
    sa.Column('portal_receiver', sa.String(length=255), nullable=False),
    sa.Column('in_community', sa.Boolean(), server_default=sa.false(), nullable=False),
    sa.ForeignKeyConstraint(['portal', 'portal_receiver'], ['portal.fbid', 'portal.fb_receiver'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('user', 'portal', 'portal_receiver')
    )
    # ### end Alembic commands ### 
开发者ID:tulir,项目名称:mautrix-facebook,代码行数:20,代码来源:3355b59b191c_add_user_portal_puppet_mappings_to_db.py

示例2: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "certificates",
        sa.Column("rotation", sa.Boolean(), nullable=False, server_default=sa.false()),
    )
    op.add_column(
        "endpoints",
        sa.Column(
            "last_updated",
            sa.DateTime(),
            server_default=sa.text("now()"),
            nullable=False,
        ),
    )
    # ### end Alembic commands ### 
开发者ID:Netflix,项目名称:lemur,代码行数:18,代码来源:131ec6accff5_.py

示例3: test_update_special_comparator

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def test_update_special_comparator(self):
        HasBoolean = self.classes.HasBoolean

        # make sure the comparison we're shooting
        # for is invalid, otherwise we need to
        # test something else here
        assert_raises_message(
            TypeError,
            "Boolean value of this clause is not defined",
            bool,
            None == sa.false(),  # noqa
        )
        s = create_session()
        hb = HasBoolean(value=None)
        s.add(hb)
        s.flush()

        hb.value = sa.false()

        s.flush()

        # needs to be refreshed
        assert "value" not in hb.__dict__
        eq_(hb.value, False) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:26,代码来源:test_unitofwork.py

示例4: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    bind = op.get_bind()
    op.add_column(
        "tables",
        sa.Column(
            "is_sqllab_view",
            sa.Boolean(),
            nullable=True,
            default=False,
            server_default=sa.false(),
        ),
    )

    session = db.Session(bind=bind)

    # Use Slice class defined here instead of models.Slice
    for tbl in session.query(Table).all():
        if tbl.sql:
            tbl.is_sqllab_view = True

    session.commit()
    db.session.close() 
开发者ID:apache,项目名称:incubator-superset,代码行数:24,代码来源:130915240929_is_sqllab_viz_flow.py

示例5: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
	alembic.op.add_column('users',
		sqlalchemy.Column('stream_delay', sqlalchemy.Integer, nullable=False, server_default='10')
	)
	alembic.op.add_column('users',
		sqlalchemy.Column('chat_timestamps', sqlalchemy.Integer, nullable=False, server_default='0')
	)
	alembic.op.add_column('users',
		sqlalchemy.Column('chat_timestamps_24hr', sqlalchemy.Boolean, nullable=False, server_default=sqlalchemy.true())
	)
	alembic.op.add_column('users',
		sqlalchemy.Column('chat_timestamps_secs', sqlalchemy.Boolean, nullable=False, server_default=sqlalchemy.false())
	) 
开发者ID:mrphlip,项目名称:lrrbot,代码行数:15,代码来源:802322a84154_add_stream_delay_prefs.py

示例6: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    try:
        op.add_column('smtpserver', sa.Column('enqueue_job', sa.Boolean(), nullable=False, server_default=sa.false()))
    except Exception as exx:
        print("Could not add column 'smtpserver.enqueue_job'")
        print(exx) 
开发者ID:privacyidea,项目名称:privacyidea,代码行数:8,代码来源:849170064430_.py

示例7: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    op.add_column('services', sa.Column('can_send_letters', sa.Boolean(), nullable=False, server_default=sa.false()))
    op.add_column('services_history', sa.Column('can_send_letters', sa.Boolean(), nullable=False, server_default=sa.false())) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:5,代码来源:0058_add_letters_flag.py

示例8: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    op.add_column('services', sa.Column('can_send_international_sms', sa.Boolean(), nullable=False, server_default=sa.false()))
    op.add_column('services_history', sa.Column('can_send_international_sms', sa.Boolean(), nullable=False, server_default=sa.false())) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:5,代码来源:0073_add_international_sms_flag.py

示例9: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    op.alter_column('service_email_reply_to', 'is_active', new_column_name='archived', server_default=sa.false())
    op.alter_column('service_letter_contacts', 'is_active', new_column_name='archived', server_default=sa.false())
    op.alter_column('service_sms_senders', 'is_active', new_column_name='archived', server_default=sa.false())

    op.execute("Update service_email_reply_to set archived = False")
    op.execute("Update service_letter_contacts set archived = False")
    op.execute("Update service_sms_senders set archived = False") 
开发者ID:alphagov,项目名称:notifications-api,代码行数:10,代码来源:0186_rename_is_active_columns.py

示例10: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    op.add_column(
        'service_contact_list',
        sa.Column('archived', sa.Boolean(), nullable=False, server_default=sa.false()),
    ) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:7,代码来源:0319_contact_list_archived.py

示例11: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    op.add_column('provider_details', sa.Column('supports_international', sa.Boolean(), nullable=False, server_default=sa.false()))
    op.add_column('provider_details_history', sa.Column('supports_international', sa.Boolean(), nullable=False, server_default=sa.false()))

    op.execute("UPDATE provider_details SET supports_international=True WHERE identifier='mmg'")
    op.execute("UPDATE provider_details_history SET supports_international=True WHERE identifier='mmg'") 
开发者ID:alphagov,项目名称:notifications-api,代码行数:8,代码来源:0076_add_intl_flag_to_provider.py

示例12: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('jobs', sa.Column('archived', sa.Boolean(), nullable=True))
    op.execute('update jobs set archived = false')
    op.alter_column('jobs', 'archived', nullable=False, server_default=sa.false())

    # ### end Alembic commands ### 
开发者ID:alphagov,项目名称:notifications-api,代码行数:9,代码来源:0245_archived_flag_jobs.py

示例13: downgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def downgrade():
    op.execute("""
        UPDATE
            services
        SET
            consent_to_research = false
    """)
    op.execute("""
        UPDATE
            services_history
        SET
            consent_to_research = false
    """)
    op.alter_column(
        'services_history',
        'consent_to_research',
        existing_type=sa.BOOLEAN(),
        nullable=False,
        server_default=sa.false(),
    )
    op.alter_column(
        'services',
        'consent_to_research',
        existing_type=sa.BOOLEAN(),
        nullable=False,
        server_default=sa.false(),
    ) 
开发者ID:alphagov,项目名称:notifications-api,代码行数:29,代码来源:0277_consent_to_research_null.py

示例14: translate_bool

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def translate_bool(bln):
    if bln:
        return true()
    return false() 
开发者ID:snowflakedb,项目名称:snowflake-sqlalchemy,代码行数:6,代码来源:custom_commands.py

示例15: test_is_boolean_symbols_despite_no_native

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def test_is_boolean_symbols_despite_no_native(self):
        is_(
            testing.db.scalar(select([cast(true().is_(true()), Boolean)])),
            True,
        )

        is_(
            testing.db.scalar(select([cast(true().isnot(true()), Boolean)])),
            False,
        )

        is_(
            testing.db.scalar(select([cast(false().is_(false()), Boolean)])),
            True,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:17,代码来源:test_query.py


注:本文中的sqlalchemy.false方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。