Here are the examples of the python api sqlalchemy.Boolean taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
404 Examples
3
Source : base.py
with MIT License
from 5783354
with MIT License
from 5783354
def Bool(cls) -> _sa.Column:
"""
Generates a column as a Boolean with default-within-project params
"""
return _sa.Column(
_sa.Boolean,
default=False,
index=False,
nullable=False,
server_default=_sa.text("false"),
)
@classmethod
3
Source : ae91c7ca9560_add_unsaved_to_user.py
with MIT License
from ADE-Scheduler
with MIT License
from ADE-Scheduler
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"user",
sa.Column(
"autosave",
sa.Boolean(),
server_default=sa.sql.expression.literal(False),
nullable=False,
),
)
# ### end Alembic commands ###
def downgrade():
3
Source : 37a7d932fc02_.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('is_admin', sa.Boolean()))
# ### end Alembic commands ###
def downgrade():
3
Source : 43c24fc4dd24_changes_for_demo.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('dataset', sa.Column('is_demo', sa.Boolean(), nullable=True))
op.add_column('user', sa.Column('is_introduced', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 48da31c2de2c_user_flags.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('read_toc', sa.Boolean(), nullable=True))
op.add_column('user', sa.Column('wants_credit', sa.Boolean(), nullable=True))
op.add_column('user', sa.Column('wants_updates', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : ab06eac38963_mark_task_assigned_by_admin.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('task', sa.Column('admin_assigned', sa.Boolean(),
nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : e58a3596b899_add_email_confirmation_field.py
with MIT License
from alan-turing-institute
with MIT License
from alan-turing-institute
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('user', sa.Column('is_confirmed', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : test_types.py
with MIT License
from analyzeDFIR
with MIT License
from analyzeDFIR
def define_tables(cls, metadata):
Table('boolean_table', metadata,
Column('id', Integer, primary_key=True, autoincrement=False),
Column('value', Boolean),
Column('unconstrained_value', Boolean(create_constraint=False)),
)
def test_render_literal_bool(self):
3
Source : test_types.py
with MIT License
from analyzeDFIR
with MIT License
from analyzeDFIR
def test_render_literal_bool(self):
self._literal_round_trip(
Boolean(),
[True, False],
[True, False]
)
def test_round_trip(self):
3
Source : fields.py
with BSD 3-Clause "New" or "Revised" License
from awesometoolbox
with BSD 3-Clause "New" or "Revised" License
from awesometoolbox
def Boolean(
*,
primary_key: bool = False,
allow_null: bool = False,
index: bool = False,
unique: bool = False,
) -> Type[bool]:
namespace = dict(
primary_key=primary_key,
allow_null=allow_null,
index=index,
unique=unique,
column_type=sqlalchemy.Boolean(),
)
return type("Boolean", (int, ColumnFactory), namespace)
def DateTime(
3
Source : 279f1e8d64eb_notificaiton_to_monitored_sub.py
with GNU General Public License v3.0
from barrycarey
with GNU General Public License v3.0
from barrycarey
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('reddit_monitored_sub', sa.Column('activation_notification_sent', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 380abce0d196_new_monitored_sub_options.py
with GNU General Public License v3.0
from barrycarey
with GNU General Public License v3.0
from barrycarey
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('reddit_monitored_sub', sa.Column('comment_on_oc', sa.Boolean(), nullable=True))
op.add_column('reddit_monitored_sub', sa.Column('comment_on_repost', sa.Boolean(), nullable=True))
op.add_column('reddit_monitored_sub', sa.Column('lock_response_comment', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 5111c30c2895_voting_column_in_report.py
with GNU General Public License v3.0
from barrycarey
with GNU General Public License v3.0
from barrycarey
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('reddit_user_report', sa.Column('sent_for_voting', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 7ecb5b67d5c9_add_filter_removed_matched_to_montiored_.py
with GNU General Public License v3.0
from barrycarey
with GNU General Public License v3.0
from barrycarey
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('reddit_monitored_sub', sa.Column('filter_removed_matches', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : e7b3e28cbe72_repost_modmail_to_monitored_sub.py
with GNU General Public License v3.0
from barrycarey
with GNU General Public License v3.0
from barrycarey
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('reddit_monitored_sub', sa.Column('send_repost_modmail', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 129eb4978d07_org_api_access.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('orgs', sa.Column('has_api_access', sa.Boolean(), nullable=True))
op.add_column('orgs_version', sa.Column('has_api_access', sa.Boolean(), autoincrement=False, nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : d46ec0214eb2_add_passcode_claimed_field.py
with Apache License 2.0
from bcgov
with Apache License 2.0
from bcgov
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('entity', sa.Column('pass_code_claimed', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
3
Source : 0309d1a2a2bc_change_boot_eligible_to_boot_eligible_.py
with GNU General Public License v3.0
from bdhowald
with GNU General Public License v3.0
from bdhowald
def upgrade():
op.alter_column('plate_lookups',
column_name='boot_eligible',
new_column_name='boot_eligible_under_rdaa_threshold',
existing_type=sa.Boolean(),
existing_nullable=False)
def downgrade():
3
Source : 0309d1a2a2bc_change_boot_eligible_to_boot_eligible_.py
with GNU General Public License v3.0
from bdhowald
with GNU General Public License v3.0
from bdhowald
def downgrade():
op.alter_column('plate_lookups_under_rdaa_threshold',
column_name='boot_eligible',
new_column_name='boot_eligible',
existing_type=sa.Boolean(),
existing_nullable=False)
3
Source : b5ef55774c73_add_new_boot_eligible_under_dvaa_column.py
with GNU General Public License v3.0
from bdhowald
with GNU General Public License v3.0
from bdhowald
def upgrade():
op.add_column('plate_lookups',
sa.Column('boot_eligible_under_dvaa_threshold',
sa.Boolean(), nullable=False, server_default=sa.false()))
op.create_index('index_boot_eligible_under_dvaa_threshold',
'plate_lookups', ['boot_eligible_under_dvaa_threshold'])
def downgrade():
3
Source : 5bf0a0845afb_fix_html_templates_rendering.py
with GNU General Public License v3.0
from bitcartcc
with GNU General Public License v3.0
from bitcartcc
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column("stores", sa.Column("use_html_templates", sa.Boolean(), nullable=True, server_default=expression.false()))
op.alter_column("stores", "use_html_templates", server_default=None)
# ### end Alembic commands ###
def downgrade():
3
Source : 88304952e3ff_added_is_locked_attribute_to_object.py
with GNU Affero General Public License v3.0
from CASES-LU
with GNU Affero General Public License v3.0
from CASES-LU
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"json_object",
sa.Column(
"is_locked",
sa.Boolean(),
nullable=False,
server_default=sa.schema.DefaultClause("False"),
),
)
op.alter_column(
"json_object", "creator_id", existing_type=sa.INTEGER(), nullable=False
)
# ### end Alembic commands ###
def downgrade():
3
Source : 93451e9eda64_added_boolean_column_is_membership_.py
with GNU Affero General Public License v3.0
from CASES-LU
with GNU Affero General Public License v3.0
from CASES-LU
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column(
"organization",
sa.Column(
"is_membership_restricted",
sa.Boolean(),
nullable=False,
server_default=sa.schema.DefaultClause("True"),
),
)
# ### end Alembic commands ###
def downgrade():
3
Source : 7695412f8a64_switch_to_boolean_search_rating_instead_.py
with MIT License
from cc-archive
with MIT License
from cc-archive
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('search_rating_event', sa.Column('relevant', sa.Boolean(), nullable=True))
op.create_index(op.f('ix_search_rating_event_relevant'), 'search_rating_event', ['relevant'], unique=False)
op.drop_column('search_rating_event', 'rating')
# ### end Alembic commands ###
def downgrade():
3
Source : 4a7a8b53b4f8_artpiece_confirmation.py
with MIT License
from cclrobotics
with MIT License
from cclrobotics
def upgrade():
op.add_column('artpieces', sa.Column('confirmed', sa.Boolean, nullable=True))
with session_scope() as session:
artpieces = session.query(ArtpieceModel).all()
for artpiece in artpieces:
artpiece.confirmed = True
op.alter_column('artpieces', 'confirmed', nullable=False)
def downgrade():
3
Source : a20324cb6d44_user_validation_and_user_id_in_email_.py
with MIT License
from cclrobotics
with MIT License
from cclrobotics
def downgrade():
op.add_column('users', sa.Column('verified', sa.Boolean, nullable=True))
with session_scope() as session:
users = session.query(UserModel).all()
for user in users:
user.verified = True
op.alter_column('users', 'verified', nullable=False)
op.add_column('emailfailures', sa.Column('user_id', sa.Integer, sa.ForeignKey('users.id'),
nullable=True))
3
Source : 0008_archive_template.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("templates", sa.Column("archived", sa.Boolean(), nullable=True))
op.add_column("templates_history", sa.Column("archived", sa.Boolean(), nullable=True))
op.get_bind()
op.execute("UPDATE templates SET archived = FALSE")
op.execute("UPDATE templates_history set archived = FALSE")
op.alter_column("templates", "archived", nullable=False)
op.alter_column("templates", "archived", nullable=False)
### end Alembic commands ###
def downgrade():
3
Source : 0023_add_research_mode.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.add_column("services", sa.Column("research_mode", sa.Boolean(), nullable=True))
op.add_column("services_history", sa.Column("research_mode", sa.Boolean(), nullable=True))
### end Alembic commands ###
def downgrade():
3
Source : 0058_add_letters_flag.py
with MIT License
from cds-snc
with MIT License
from cds-snc
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()),
)
def downgrade():
3
Source : 0077_add_intl_notification.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("notification_history", sa.Column("international", sa.Boolean(), nullable=True))
op.add_column("notification_history", sa.Column("phone_prefix", sa.String(), nullable=True))
op.add_column(
"notification_history",
sa.Column("rate_multiplier", sa.Numeric(), nullable=True),
)
op.add_column("notifications", sa.Column("international", sa.Boolean(), nullable=True))
op.add_column("notifications", sa.Column("phone_prefix", sa.String(), nullable=True))
op.add_column("notifications", sa.Column("rate_multiplier", sa.Numeric(), nullable=True))
def downgrade():
3
Source : 0132_add_sms_prefix_setting.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("services", sa.Column("prefix_sms", sa.Boolean(), nullable=True))
op.add_column("services_history", sa.Column("prefix_sms", sa.Boolean(), nullable=True))
def downgrade():
3
Source : 0168_hidden_templates.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column("templates", sa.Column("hidden", sa.Boolean(), nullable=True))
op.add_column("templates_history", sa.Column("hidden", sa.Boolean(), nullable=True))
def downgrade():
3
Source : 0185_add_is_active_to_reply_tos.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column(
"service_email_reply_to",
sa.Column("is_active", sa.Boolean(), nullable=False, server_default=sa.true()),
)
op.add_column(
"service_letter_contacts",
sa.Column("is_active", sa.Boolean(), nullable=False, server_default=sa.true()),
)
op.add_column(
"service_sms_senders",
sa.Column("is_active", sa.Boolean(), nullable=False, server_default=sa.true()),
)
def downgrade():
3
Source : 0245_archived_flag_jobs.py
with MIT License
from cds-snc
with MIT License
from cds-snc
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 ###
def downgrade():
3
Source : 0261_service_volumes.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
for table in TABLES:
op.add_column(
table,
sa.Column(
"consent_to_research",
sa.Boolean(),
nullable=False,
server_default=sa.false(),
),
)
for channel in CHANNELS:
op.add_column(table, sa.Column(channel, sa.Integer(), nullable=True))
def downgrade():
3
Source : 0282_add_count_as_live.py
with MIT License
from cds-snc
with MIT License
from cds-snc
def upgrade():
op.add_column(
"services",
sa.Column("count_as_live", sa.Boolean(), nullable=False, server_default=sa.true()),
)
op.add_column(
"services_history",
sa.Column("count_as_live", sa.Boolean(), nullable=False, server_default=sa.true()),
)
def downgrade():
3
Source : 044_update_drafts_schema.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"spoolmessage",
sa.Column(
"is_reply",
sa.Boolean(),
server_default=sa.sql.expression.false(),
nullable=False,
),
)
# Drop draft_copied_from and replyto_thread_id foreign key constraints.
op.drop_constraint("spoolmessage_ibfk_4", "spoolmessage", type_="foreignkey")
op.drop_constraint("spoolmessage_ibfk_5", "spoolmessage", type_="foreignkey")
op.drop_column("spoolmessage", "draft_copied_from")
op.drop_column("spoolmessage", "replyto_thread_id")
op.drop_table("draftthread")
def downgrade():
3
Source : 077_add_supports_condstore_column_to_.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"genericaccount", sa.Column("supports_condstore", sa.Boolean(), nullable=True)
)
def downgrade():
3
Source : 098_add_throttling_support.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"account",
sa.Column("throttled", sa.Boolean(), server_default="0", nullable=True),
)
def downgrade():
3
Source : 142_add_sync_run_bit.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"account",
sa.Column("sync_should_run", sa.Boolean(), server_default="1", nullable=True),
)
def downgrade():
3
Source : 176_add_run_state_folderstatus.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"imapfoldersyncstatus",
sa.Column(
"sync_should_run",
sa.Boolean(),
server_default=sa.sql.expression.true(),
nullable=False,
),
)
def downgrade():
3
Source : 177_add_run_state_eas_folderstatus.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
from inbox.ignition import main_engine
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easfoldersyncstatus"):
return
op.add_column(
"easfoldersyncstatus",
sa.Column(
"sync_should_run",
sa.Boolean(),
server_default=sa.sql.expression.true(),
nullable=False,
),
)
def downgrade():
3
Source : 190_eas_add_device_retirement.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
from inbox.ignition import main_engine
engine = main_engine(pool_size=1, max_overflow=0)
if not engine.has_table("easdevice"):
return
op.add_column(
"easdevice",
sa.Column(
"retired",
sa.Boolean(),
server_default=sa.sql.expression.false(),
nullable=False,
),
)
def downgrade():
3
Source : 201_add_sync_email_bit_to_account.py
with GNU Affero General Public License v3.0
from closeio
with GNU Affero General Public License v3.0
from closeio
def upgrade():
op.add_column(
"account",
sa.Column(
"sync_email",
sa.Boolean(),
nullable=False,
server_default=sa.sql.expression.true(),
),
)
def downgrade():
3
Source : 1d9e835a84f9_.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.add_column(
"dbs",
sa.Column(
"allow_csv_upload",
sa.Boolean(),
nullable=False,
server_default=expression.true(),
),
)
def downgrade():
3
Source : 41f6a59a61f2_database_options_for_sql_lab.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.add_column("dbs", sa.Column("allow_ctas", sa.Boolean(), nullable=True))
op.add_column("dbs", sa.Column("expose_in_sqllab", sa.Boolean(), nullable=True))
op.add_column(
"dbs", sa.Column("force_ctas_schema", sa.String(length=250), nullable=True)
)
def downgrade():
3
Source : 4500485bde7d_allow_run_sync_async.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.add_column("dbs", sa.Column("allow_run_async", sa.Boolean(), nullable=True))
op.add_column("dbs", sa.Column("allow_run_sync", sa.Boolean(), nullable=True))
def downgrade():
3
Source : 7467e77870e4_remove_aggs.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def downgrade():
op.add_column("table_columns", sa.Column("min", sa.Boolean(), nullable=True))
op.add_column(
"table_columns", sa.Column("count_distinct", sa.Boolean(), nullable=True)
)
op.add_column("table_columns", sa.Column("sum", sa.Boolean(), nullable=True))
op.add_column("table_columns", sa.Column("max", sa.Boolean(), nullable=True))
op.add_column("table_columns", sa.Column("avg", sa.Boolean(), nullable=True))
op.add_column("columns", sa.Column("min", sa.Boolean(), nullable=True))
op.add_column("columns", sa.Column("count_distinct", sa.Boolean(), nullable=True))
op.add_column("columns", sa.Column("sum", sa.Boolean(), nullable=True))
op.add_column("columns", sa.Column("max", sa.Boolean(), nullable=True))
op.add_column("columns", sa.Column("avg", sa.Boolean(), nullable=True))
3
Source : ad4d656d92bc_add_avg_metric.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
op.add_column("columns", sa.Column("avg", sa.Boolean(), nullable=True))
op.add_column("table_columns", sa.Column("avg", sa.Boolean(), nullable=True))
def downgrade():
3
Source : d6ffdf31bdd4_add_published_column_to_dashboards.py
with Apache License 2.0
from CloudmindsRobot
with Apache License 2.0
from CloudmindsRobot
def upgrade():
with op.batch_alter_table("dashboards") as batch_op:
batch_op.add_column(sa.Column("published", sa.Boolean(), nullable=True))
op.execute("UPDATE dashboards SET published='1'")
def downgrade():
See More Examples