sqlalchemy.VARCHAR

Here are the examples of the python api sqlalchemy.VARCHAR taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

115 Examples 7

Example 1

Project: sqlalchemy
Source File: test_insert_exec.py
View license
    @classmethod
    def define_tables(cls, metadata):
        Table(
            'users', metadata,
            Column(
                'user_id', INT, primary_key=True,
                test_needs_autoincrement=True),
            Column('user_name', VARCHAR(20)),
            test_needs_acid=True
        )

Example 2

View license
def downgrade():
    op.drop_constraint(None, 'user', type_='foreignkey')
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.drop_index(op.f('ix_user_email_user_id'), table_name='user_email')
    op.drop_index(op.f('ix_user_email_email'), table_name='user_email')
    op.drop_table('user_email')

Example 3

Project: cslbot
Source File: 4d165186b4ed_fix_nullable.py
View license
def upgrade():
    if op.get_bind().dialect.name == 'sqlite':
        with op.batch_alter_table('babble') as batch_op:
            batch_op.alter_column('key', existing_type=sa.VARCHAR(length=512), nullable=True)
            batch_op.alter_column('source', existing_type=sa.TEXT(), nullable=True)
            batch_op.alter_column('target', existing_type=sa.TEXT(), nullable=True)
            batch_op.alter_column('word', existing_type=sa.TEXT(), nullable=True)
    else:
        op.alter_column('babble', 'key', existing_type=sa.VARCHAR(length=512), nullable=True)
        op.alter_column('babble', 'source', existing_type=sa.TEXT(), nullable=True)
        op.alter_column('babble', 'target', existing_type=sa.TEXT(), nullable=True)
        op.alter_column('babble', 'word', existing_type=sa.TEXT(), nullable=True)

Example 4

Project: alembic
Source File: test_autogen_diffs.py
View license
    def test_string(self):
        t1 = String(30)
        t2 = String(40)
        t3 = VARCHAR(30)
        t4 = Integer

        impl = self._fixture()
        is_(impl.compare_type(Column('x', t3), Column('x', t1)), False)
        is_(impl.compare_type(Column('x', t3), Column('x', t2)), True)
        is_(impl.compare_type(Column('x', t3), Column('x', t4)), True)

Example 5

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'company', sa.Column('contact_phone', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_addr1', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_addr2', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_first_name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_email', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_zip', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_last_name', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_city', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column(u'company', sa.Column('contact_state', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.drop_table('company_contact')

Example 6

View license
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('contract_property', 'key',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)
    op.alter_column('stage_property', 'key',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)

Example 7

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('stage_property', 'key',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.alter_column('contract_property', 'key',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)

Example 8

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('stage', 'default_message')
    op.add_column('contract', sa.Column('contract_type', sa.VARCHAR(length=255), autoincrement=False, nullable=True))

    op.execute(
        sa.sql.text(
            '''
            UPDATE contract SET contract_type = (
                SELECT name from contract_type WHERE contract.contract_type_id = contract_type.id
            )
            '''
        )
    )

    op.drop_constraint('contract_id_contract_type_contract_id_fkey', 'contract', type_='foreignkey')
    op.drop_column('contract', 'contract_type_id')
    op.drop_index(op.f('ix_contract_type_id'), table_name='contract_type')
    op.drop_table('contract_type')

Example 9

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'test', sa.Column(u'group_sha', sa.VARCHAR(length=40), nullable=True))
    op.add_column(u'test', sa.Column(u'group', sa.TEXT(), nullable=True))
    op.drop_column(u'test', 'suite_id')
    op.drop_table('testgroup_test')
    op.drop_table('testgroup')
    op.drop_table('testsuite')

Example 10

Project: WatchPeopleCode
Source File: 2f8bfdb8907a_.py
View license
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('stream', 'channel',
               existing_type=sa.VARCHAR(length=25),
               nullable=True)
    op.alter_column('stream', 'ytid',
               existing_type=sa.VARCHAR(length=11),
               nullable=True)

Example 11

Project: WatchPeopleCode
Source File: 2f8bfdb8907a_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('stream', 'ytid',
               existing_type=sa.VARCHAR(length=11),
               nullable=False)
    op.alter_column('stream', 'channel',
               existing_type=sa.VARCHAR(length=25),
               nullable=False)

Example 12

Project: WatchPeopleCode
Source File: 33dc40a1e6b3_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tag',
    sa.Column('name', sa.VARCHAR(length=256), autoincrement=False, nullable=False),
    sa.PrimaryKeyConstraint('name', name=u'tag_pkey'),
    postgresql_ignore_search_path=False
    )
    op.create_table('stream_tag',
    sa.Column('stream_id', sa.INTEGER(), autoincrement=False, nullable=True),
    sa.Column('tag_name', sa.VARCHAR(length=256), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['stream_id'], [u'stream.id'], name=u'stream_tag_stream_id_fkey'),
    sa.ForeignKeyConstraint(['tag_name'], [u'tag.name'], name=u'stream_tag_tag_name_fkey')
    )

Example 13

Project: WatchPeopleCode
Source File: 4691e59fa601_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'stream', type_='unique')
    op.drop_column('stream', 'viewer_num')
    op.drop_column('stream', 'channel_name')
    op.create_table('wpc_stream',
    sa.Column('path', sa.VARCHAR(length=30), autoincrement=False, nullable=False),
    sa.Column('is_live', sa.BOOLEAN(), autoincrement=False, nullable=True),
    sa.PrimaryKeyConstraint('path', name=u'wpc_stream_pkey')
    )

Example 14

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('avatar', sa.VARCHAR(length=200), autoincrement=False, nullable=True))
    op.add_column('user', sa.Column('tokens', sa.TEXT(), autoincrement=False, nullable=True))
    op.drop_column('eventsusers', 'role')
    op.create_unique_constraint(u'events_name_key', 'events', ['name'])
    op.drop_column('events', 'state')

Example 15

View license
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('call_for_papers', 'privacy',
               existing_type=sa.VARCHAR(),
               nullable=False)
    op.alter_column('call_for_papers', 'timezone',
               existing_type=sa.VARCHAR(),
               nullable=False)
    op.add_column('events', sa.Column('thumbnail', sa.String(), nullable=True))
    op.add_column('events_version', sa.Column('thumbnail', sa.String(), autoincrement=False, nullable=True))

Example 16

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('events_version', 'thumbnail')
    op.drop_column('events', 'thumbnail')
    op.alter_column('call_for_papers', 'timezone',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.alter_column('call_for_papers', 'privacy',
               existing_type=sa.VARCHAR(),
               nullable=True)

Example 17

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('session_version', sa.Column('timezone', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.add_column('session', sa.Column('timezone', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.alter_column('events', 'has_session_speakers',
               existing_type=sa.BOOLEAN(),
               nullable=False)
    op.drop_column('call_for_papers', 'timezone')

Example 18

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'panel_permissions', sa.Column('role_name', sa.VARCHAR(), autoincrement=False, nullable=True))
    op.drop_constraint(None, 'panel_permissions', type_='foreignkey')
    op.drop_column(u'panel_permissions', 'role_id')
    op.drop_table('custom_sys_role')

Example 19

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('session', 'timezone',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.drop_column('events_version', 'has_session_speakers')
    op.drop_column('events', 'has_session_speakers')

Example 20

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('user') as batch_op:
        batch_op.alter_column('user', 'password',
               existing_type=sqlalchemy_utils.types.password.PasswordType(max_length=128),
               type_=sa.VARCHAR(length=128),
               existing_nullable=False)
        batch_op.drop_column('updated')
        batch_op.drop_column('created')

Example 21

View license
def upgrade():
    connection = op.get_bind()
    room = VenueRoom.__table__
    updt_stmt = room.update().where(room.c.bgcolor == None).values(bgcolor=u'229922')
    connection.execute(updt_stmt)
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('venue_room', 'bgcolor',
               existing_type=sa.VARCHAR(length=6),
               nullable=False)

Example 22

View license
def upgrade():
    op.alter_column('job_application', 'message_html', new_column_name='message')
    op.drop_column('job_application', 'message_text')
    op.alter_column('job_application', 'email',
               existing_type=sa.VARCHAR(length=80),
               nullable=False)
    op.alter_column('job_application', 'phone',
               existing_type=sa.VARCHAR(length=80),
               nullable=False)

Example 23

View license
def downgrade():
    op.alter_column('job_application', 'phone',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('job_application', 'email',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('job_application', 'message', new_column_name='message_html')
    op.add_column('job_application', sa.Column('message_text', sa.TEXT(), nullable=True))

Example 24

View license
def upgrade():
    op.execute('CREATE SCHEMA events')
    op.create_table('event_index',
                    sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
                    sa.Column('title_vector', TSVECTOR(), autoincrement=False, nullable=True),
                    sa.Column('start_date', postgresql.TIMESTAMP(), autoincrement=False, nullable=True),
                    sa.PrimaryKeyConstraint('id', name=u'event_index_pkey'),
                    sa.Index('title_vector_idx', 'title_vector', postgresql_using='gin'),
                    schema='events')

    op.create_table('category_index',
                    sa.Column('id', sa.VARCHAR(), autoincrement=False, nullable=False),
                    sa.Column('title_vector', TSVECTOR(), autoincrement=False, nullable=True),
                    sa.PrimaryKeyConstraint('id', name=u'category_index_pkey'),
                    sa.Index('title_vector_idx', 'title_vector', postgresql_using='gin'),
                    schema='indico')

Example 25

View license
def downgrade():
    op.add_column('feed', sa.Column('icon', sa.VARCHAR(), nullable=True))
    if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
        op.drop_constraint(None, 'feed', type_='foreignkey')
        op.drop_column('feed', 'icon_url')
    op.drop_table('icon')

Example 26

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('username', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.create_index('ix_users_username', 'users', ['username'], unique=True)
    op.drop_column('users', 'last_name')
    op.drop_column('users', 'first_name')

Example 27

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('users', sa.Column('username', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.create_index('ix_users_username', 'users', ['username'], unique=True)
    op.drop_column('users', 'last_name')
    op.drop_column('users', 'first_name')

Example 28

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('dependency_change', sa.Column(u'curr_dep_evr', sa.VARCHAR(), nullable=True))
    op.add_column('dependency_change', sa.Column(u'prev_dep_evr', sa.VARCHAR(), nullable=True))
    op.drop_column('dependency_change', 'curr_version')
    op.drop_column('dependency_change', 'prev_version')
    op.drop_column('dependency_change', 'prev_epoch')
    op.drop_column('dependency_change', 'curr_release')
    op.drop_column('dependency_change', 'prev_release')
    op.drop_column('dependency_change', 'curr_epoch')
    op.add_column('dependency', sa.Column(u'evr', sa.VARCHAR(), nullable=False))
    op.drop_column('dependency', 'version')
    op.drop_column('dependency', 'epoch')
    op.drop_column('dependency', 'release')

Example 29

Project: lemur
Source File: 3307381f3b88_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'certificates', type_='foreignkey')
    op.drop_constraint(None, 'certificates', type_='foreignkey')
    op.create_foreign_key(u'certificates_authority_id_fkey', 'certificates', 'authorities', ['authority_id'], ['id'])
    op.alter_column('certificates', 'owner',
               existing_type=sa.VARCHAR(length=128),
               nullable=True)
    op.alter_column('certificates', 'body',
               existing_type=sa.TEXT(),
               nullable=True)
    op.drop_column('certificates', 'root_authority_id')
    op.add_column('authorities', sa.Column('not_before', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('cn', sa.VARCHAR(length=128), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('bits', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('not_after', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.alter_column('authorities', 'owner',
               existing_type=sa.VARCHAR(length=128),
               nullable=True)

Example 30

Project: lemur
Source File: 3307381f3b88_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'certificates', type_='foreignkey')
    op.drop_constraint(None, 'certificates', type_='foreignkey')
    op.create_foreign_key(u'certificates_authority_id_fkey', 'certificates', 'authorities', ['authority_id'], ['id'])
    op.alter_column('certificates', 'owner',
               existing_type=sa.VARCHAR(length=128),
               nullable=True)
    op.alter_column('certificates', 'body',
               existing_type=sa.TEXT(),
               nullable=True)
    op.drop_column('certificates', 'root_authority_id')
    op.add_column('authorities', sa.Column('not_before', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('cn', sa.VARCHAR(length=128), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('bits', sa.INTEGER(), autoincrement=False, nullable=True))
    op.add_column('authorities', sa.Column('not_after', postgresql.TIMESTAMP(), autoincrement=False, nullable=True))
    op.alter_column('authorities', 'owner',
               existing_type=sa.VARCHAR(length=128),
               nullable=True)

Example 31

Project: security_monkey
Source File: 595e27f36454_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'itemaudit', type_='foreignkey')
    op.drop_column('itemaudit', 'auditor_setting_id')
    op.add_column('auditorsettings', sa.Column('issue', sa.VARCHAR(length=512), autoincrement=False, nullable=False))
    op.add_column('auditorsettings', sa.Column('notes', sa.VARCHAR(length=512), autoincrement=False, nullable=True))
    op.drop_column('auditorsettings', 'issue_text')

Example 32

Project: security_monkey
Source File: 595e27f36454_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, 'itemaudit', type_='foreignkey')
    op.drop_column('itemaudit', 'auditor_setting_id')
    op.add_column('auditorsettings', sa.Column('issue', sa.VARCHAR(length=512), autoincrement=False, nullable=False))
    op.add_column('auditorsettings', sa.Column('notes', sa.VARCHAR(length=512), autoincrement=False, nullable=True))
    op.drop_column('auditorsettings', 'issue_text')

Example 33

View license
def downgrade():
    op.add_column('feed', sa.Column('icon', sa.VARCHAR(), nullable=True))
    if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
        op.drop_constraint(None, 'feed', type_='foreignkey')
        op.drop_column('feed', 'icon_url')
    op.drop_table('icon')

Example 34

View license
def downgrade():
    op.add_column('feed', sa.Column('icon', sa.VARCHAR(), nullable=True))
    if 'sqlite' not in conf.SQLALCHEMY_DATABASE_URI:
        op.drop_constraint(None, 'feed', type_='foreignkey')
        op.drop_column('feed', 'icon_url')
    op.drop_table('icon')

Example 35

Project: ceilometer
Source File: 009_event_strings.py
View license
def upgrade(migrate_engine):
    meta = MetaData(bind=migrate_engine)
    name = Table('unique_name', meta, autoload=True)
    name.c.key.alter(type=VARCHAR(length=255))
    trait = Table('trait', meta, autoload=True)
    trait.c.t_string.alter(type=VARCHAR(length=255))

Example 36

Project: pygotham
Source File: 9d0181579c_.py
View license
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=False)

Example 37

Project: pygotham
Source File: 9d0181579c_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)

Example 38

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'telephony_message', sa.Column(u'text', sa.VARCHAR(length=160), nullable=True))
    op.add_column('radio_scheduledprogram', sa.Column(u'deleted', sa.BOOLEAN(), nullable=True))

Example 39

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user_user', sa.Column(u'name', sa.VARCHAR(length=100), nullable=False))

Example 40

View license
def downgrade():
    op.add_column(
        'snapshot',
        sa.Column(
            'resource_repr',
            sa.VARCHAR(length=64),
            autoincrement=False,
            nullable=False))
    op.add_column(
        'snapshot',
        sa.Column(
            'resource_id',
            sa.INTEGER(),
            autoincrement=False,
            nullable=False))
    op.create_index(
        'ix_snapshot_resource_id', 'snapshot', ['resource_id'], unique=False)
    op.drop_index(op.f('ix_snapshot_resource_pkey'), table_name='snapshot')
    op.drop_column('snapshot', 'resource_pkey')
    op.drop_column('snapshot', 'resource_name')

Example 41

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('key', sa.Column('uid', sa.VARCHAR(length=255), autoincrement=False, nullable=False))
    op.drop_table('UID')

Example 42

View license
def downgrade():
    op.alter_column(table_name='project', column_name='external_auth_token_id', new_column_name='github_auth_token_id')
    op.add_column('project', sa.Column('gitlab_private_token', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column('project', sa.Column('gitlab_base_uri', sa.VARCHAR(length=255), autoincrement=False, nullable=True))

Example 43

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('project', sa.Column('hipchat_room', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
    op.add_column('project', sa.Column('hipchat_api_token', sa.VARCHAR(length=255), autoincrement=False, nullable=True))

Example 44

Project: beavy
Source File: 47de1903b00_.py
View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('objects', sa.Column('title', sa.VARCHAR(length=255), autoincrement=False, nullable=False))

Example 45

View license
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('role', 'name',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('role', 'description',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.alter_column('rating', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('rating', 'sigma',
               existing_type=postgresql.DOUBLE_PRECISION(precision=53),
               nullable=True)
    op.alter_column('rating', 'rating',
               existing_type=postgresql.DOUBLE_PRECISION(precision=53),
               nullable=True)
    op.alter_column('player', 'user_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('player', 'token',
               existing_type=sa.TEXT(),
               nullable=True)
    op.alter_column('player', 'server_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('player', 'name',
               existing_type=sa.VARCHAR(length=20),
               nullable=True)
    op.alter_column('myuser', 'login_count',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('myuser', 'email',
               existing_type=sa.VARCHAR(length=255),
               nullable=True)
    op.alter_column('myuser', 'claimed',
               existing_type=sa.BOOLEAN(),
               nullable=True)
    op.alter_column('myuser', 'active',
               existing_type=sa.BOOLEAN(),
               nullable=True)
    op.alter_column('go_server', 'url',
               existing_type=sa.VARCHAR(length=180),
               nullable=True)
    op.alter_column('go_server', 'token',
               existing_type=sa.TEXT(),
               nullable=True)
    op.alter_column('go_server', 'name',
               existing_type=sa.VARCHAR(length=80),
               nullable=True)
    op.alter_column('game', 'white_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('game', 'server_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('game', 'result',
               existing_type=sa.VARCHAR(length=10),
               nullable=True)
    op.alter_column('game', 'rated',
               existing_type=sa.BOOLEAN(),
               nullable=True)
    op.alter_column('game', 'komi',
               existing_type=postgresql.DOUBLE_PRECISION(precision=53),
               nullable=True)
    op.alter_column('game', 'handicap',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('game', 'date_reported',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True)
    op.alter_column('game', 'date_played',
               existing_type=postgresql.TIMESTAMP(),
               nullable=True)
    op.alter_column('game', 'black_id',
               existing_type=sa.INTEGER(),
               nullable=True)

Example 46

Project: sqlalchemy
Source File: test_compiler.py
View license
    def test_varchar_raise(self):
        for type_ in (
            String,
            VARCHAR,
            String(),
            VARCHAR(),
            NVARCHAR(),
            Unicode,
            Unicode(),
        ):
            type_ = sqltypes.to_instance(type_)
            assert_raises_message(
                exc.CompileError,
                "VARCHAR requires a length on dialect mysql",
                type_.compile,
                dialect=mysql.dialect()
            )

            t1 = Table('sometable', MetaData(),
                       Column('somecolumn', type_)
                       )
            assert_raises_message(
                exc.CompileError,
                r"\(in table 'sometable', column 'somecolumn'\)\: "
                r"(?:N)?VARCHAR requires a length on dialect mysql",
                schema.CreateTable(t1).compile,
                dialect=mysql.dialect()
            )

Example 47

Project: sqlalchemy
Source File: test_firebird.py
View license
    def test_varchar_raise(self):
        for type_ in (
            String,
            VARCHAR,
            String(),
            VARCHAR(),
            Unicode,
            Unicode(),
        ):
            type_ = sqltypes.to_instance(type_)
            assert_raises_message(
                exc.CompileError,
                "VARCHAR requires a length on dialect firebird",
                type_.compile,
            dialect=firebird.dialect())

            t1 = Table('sometable', MetaData(),
                Column('somecolumn', type_)
            )
            assert_raises_message(
                exc.CompileError,
                r"\(in table 'sometable', column 'somecolumn'\)\: "
                r"(?:N)?VARCHAR requires a length on dialect firebird",
                schema.CreateTable(t1).compile,
                dialect=firebird.dialect()
            )

Example 48

Project: sqlalchemy
Source File: test_query.py
View license
    @classmethod
    def setup_class(cls):
        global users, users2, addresses, metadata
        metadata = MetaData(testing.db)
        users = Table(
            'query_users', metadata,
            Column(
                'user_id', INT, primary_key=True,
                test_needs_autoincrement=True),
            Column('user_name', VARCHAR(20)),
            test_needs_acid=True
        )
        addresses = Table(
            'query_addresses', metadata,
            Column(
                'address_id', Integer, primary_key=True,
                test_needs_autoincrement=True),
            Column('user_id', Integer, ForeignKey('query_users.user_id')),
            Column('address', String(30)),
            test_needs_acid=True
        )

        users2 = Table(
            'u2', metadata,
            Column('user_id', INT, primary_key=True),
            Column('user_name', VARCHAR(20)),
            test_needs_acid=True
        )

        metadata.create_all()

Example 49

Project: sqlalchemy
Source File: test_query.py
View license
    @classmethod
    def setup_class(cls):
        global users, addresses, metadata
        metadata = MetaData(testing.db)
        users = Table(
            'query_users', metadata,
            Column('user_id', INT, primary_key=True),
            Column('user_name', VARCHAR(20)),
        )
        addresses = Table(
            'query_addresses', metadata,
            Column('address_id', Integer, primary_key=True),
            Column('user_id', Integer, ForeignKey('query_users.user_id')),
            Column('address', String(30)))
        metadata.create_all()

        users.insert().execute(user_id=1, user_name='john')
        addresses.insert().execute(address_id=1, user_id=1, address='addr1')
        users.insert().execute(user_id=2, user_name='jack')
        addresses.insert().execute(address_id=2, user_id=2, address='addr1')
        users.insert().execute(user_id=3, user_name='ed')
        addresses.insert().execute(address_id=3, user_id=3, address='addr2')
        users.insert().execute(user_id=4, user_name='wendy')
        addresses.insert().execute(address_id=4, user_id=4, address='addr3')
        users.insert().execute(user_id=5, user_name='laura')
        addresses.insert().execute(address_id=5, user_id=5, address='addr4')
        users.insert().execute(user_id=6, user_name='ralph')
        addresses.insert().execute(address_id=6, user_id=6, address='addr5')
        users.insert().execute(user_id=7, user_name='fido')
        addresses.insert().execute(address_id=7, user_id=7, address='addr5')

Example 50

View license
def downgrade():
    op.add_column('problemopsysreleases', sa.Column(u'probable_fix', sa.VARCHAR(length=256), autoincrement=False, nullable=True))
    op.drop_column('problemopsysreleases', 'probable_fix_build_id')