當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。