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.
145 Examples
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_add_comment(self):
context = op_fixture("postgresql")
op.alter_column(
"t",
"c",
existing_type=Boolean(),
schema="foo",
comment="This is a column comment",
)
context.astert_(
"COMMENT ON COLUMN foo.t.c IS 'This is a column comment'"
)
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_add_comment_quoting(self):
context = op_fixture("postgresql")
op.alter_column(
"t",
"c",
existing_type=Boolean(),
schema="foo",
comment="This is a column 'comment'",
)
context.astert_(
"COMMENT ON COLUMN foo.t.c IS 'This is a column ''comment'''"
)
3
View Complete Implementation : test_op.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_alter_column_schema_schema_type_existing_type(self):
context = op_fixture("mssql", native_boolean=False)
op.alter_column(
"t",
"c",
type_=String(10),
existing_type=Boolean(name="xyz"),
schema="foo",
)
context.astert_(
"ALTER TABLE foo.t DROP CONSTRAINT xyz",
"ALTER TABLE foo.t ALTER COLUMN c VARCHAR(10)",
)
3
View Complete Implementation : test_mysql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_add_comment(self):
context = op_fixture("mysql")
op.alter_column(
"t1",
"c1",
comment="This is a column comment",
existing_type=Boolean(),
schema="foo",
)
context.astert_(
"ALTER TABLE foo.t1 MODIFY c1 BOOL NULL "
"COMMENT 'This is a column comment'"
)
3
View Complete Implementation : test_mysql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_alter_column_remove_schematype(self):
context = op_fixture("mysql")
op.alter_column(
"t",
"c",
type_=Integer,
existing_type=Boolean(create_constraint=True, name="ck1"),
server_default=None,
)
context.astert_("ALTER TABLE t MODIFY c INTEGER NULL")
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_render_server_default_native_boolean(self):
c = Column(
"updated_at", Boolean(), server_default=false(), nullable=False
)
result = autogenerate.render._render_column(c, self.autogen_context)
eq_ignore_whitespace(
result,
"sa.Column('updated_at', sa.Boolean(), "
"server_default=sa.text(!U'false'), "
"nullable=False)",
)
3
View Complete Implementation : test_op_naming_convention.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
def test_add_column_schema_type_w_f(self):
context = op_fixture(
naming_convention={"ck": "ck_%(table_name)s_%(constraint_name)s"}
)
op.add_column(
"t1", Column("c1", Boolean(name=op.f("foo")), nullable=False)
)
context.astert_(
"ALTER TABLE t1 ADD COLUMN c1 BOOLEAN NOT NULL",
"ALTER TABLE t1 ADD CONSTRAINT foo CHECK (c1 IN (0, 1))",
)
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_drop_comment(self):
context = op_fixture("postgresql")
op.alter_column(
"t",
"c",
existing_type=Boolean(),
schema="foo",
comment=None,
existing_comment="This is a column comment",
)
context.astert_("COMMENT ON COLUMN foo.t.c IS NULL")
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_add_comment_table_and_column_quoting(self):
context = op_fixture("postgresql")
op.alter_column(
"T",
"C",
existing_type=Boolean(),
schema="foo",
comment="This is a column comment",
)
context.astert_(
'COMMENT ON COLUMN foo."T"."C" IS \'This is a column comment\''
)
3
View Complete Implementation : test_postgresql.py
Copyright MIT License
Author : sqlalchemy
Copyright MIT License
Author : sqlalchemy
@config.requirements.comments_api
def test_alter_column_with_comment(self):
context = op_fixture("postgresql")
op.alter_column(
"t",
"c",
nullable=False,
existing_type=Boolean(),
schema="foo",
comment="This is a column comment",
)
context.astert_(
"ALTER TABLE foo.t ALTER COLUMN c SET NOT NULL",
"COMMENT ON COLUMN foo.t.c IS 'This is a column comment'",
)