本文整理汇总了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 ###
示例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)
示例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()
示例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())
)
示例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)
示例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()))
示例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()))
示例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")
示例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()),
)
示例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'")
示例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 ###
示例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(),
)
示例14: translate_bool
# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import false [as 别名]
def translate_bool(bln):
if bln:
return true()
return false()
示例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,
)