我们从Python开源项目中,提取了以下29个代码示例,用于说明如何使用sqlalchemy.dialects.mysql.MEDIUMTEXT。
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('users', sa.Column('name', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('id', sa.String(length=32), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('first_seen', sa.DateTime(), nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True), sa.Column('user_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('name'), sa.UniqueConstraint('name') ) # removed to fix merge conflict #op.add_column('posts', sa.Column('created_at', sa.DateTime(), nullable=True)) # op.drop_index('posts_ibfk_1', table_name='posts') op.add_column('subreddits', sa.Column('created_at', sa.DateTime(), nullable=True)) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('users', sa.Column('name', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('id', sa.String(length=32), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('first_seen', sa.DateTime(), nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True), sa.Column('user_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('name'), sa.UniqueConstraint('name') ) # removed to fix merge conflict #op.add_column('posts', sa.Column('created_at', sa.DateTime(), nullable=True)) # op.drop_index('posts_ibfk_1', table_name='posts') op.add_column('subreddits', sa.Column('created_at', sa.DateTime(), nullable=True)) ### end Alembic commands ###
def upgrade_production(): ### commands auto generated by Alembic - please adjust! ### op.create_table('users', sa.Column('name', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('id', sa.String(length=32), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('first_seen', sa.DateTime(), nullable=True), sa.Column('last_seen', sa.DateTime(), nullable=True), sa.Column('user_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('name'), sa.UniqueConstraint('name') ) # removed to fix merge conflict #op.add_column('posts', sa.Column('created_at', sa.DateTime(), nullable=True)) # op.drop_index('posts_ibfk_1', table_name='posts') op.add_column('subreddits', sa.Column('created_at', sa.DateTime(), nullable=True)) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('archived_comments', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('post_id', sa.String(length=32), nullable=True), sa.Column('user_id', sa.String(length=64), nullable=True), sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_archived_comments_created_at'), 'archived_comments', ['created_at'], unique=False) op.create_index(op.f('ix_archived_comments_post_id'), 'archived_comments', ['post_id'], unique=False) op.create_index(op.f('ix_archived_comments_subreddit_id'), 'archived_comments', ['subreddit_id'], unique=False) op.create_index(op.f('ix_archived_comments_user_id'), 'archived_comments', ['user_id'], unique=False) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('archived_comments', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('post_id', sa.String(length=32), nullable=True), sa.Column('user_id', sa.String(length=64), nullable=True), sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_archived_comments_created_at'), 'archived_comments', ['created_at'], unique=False) op.create_index(op.f('ix_archived_comments_post_id'), 'archived_comments', ['post_id'], unique=False) op.create_index(op.f('ix_archived_comments_subreddit_id'), 'archived_comments', ['subreddit_id'], unique=False) op.create_index(op.f('ix_archived_comments_user_id'), 'archived_comments', ['user_id'], unique=False) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('mod_actions', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('mod', sa.String(length=64), nullable=True), sa.Column('target_author', sa.String(length=64), nullable=True), sa.Column('action', sa.String(length=256), nullable=True), sa.Column('target_fullname', sa.String(length=256), nullable=True), sa.Column('action_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_mod_actions_subreddit_id'), 'mod_actions', ['subreddit_id'], unique=False) op.create_index(op.f('ix_mod_actions_target_author'), 'mod_actions', ['target_author'], unique=False) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('mod_actions', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('mod', sa.String(length=64), nullable=True), sa.Column('target_author', sa.String(length=64), nullable=True), sa.Column('action', sa.String(length=256), nullable=True), sa.Column('target_fullname', sa.String(length=256), nullable=True), sa.Column('action_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_mod_actions_subreddit_id'), 'mod_actions', ['subreddit_id'], unique=False) op.create_index(op.f('ix_mod_actions_target_author'), 'mod_actions', ['target_author'], unique=False) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('comments', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('post_id', sa.String(length=32), nullable=True), sa.Column('user_id', sa.String(length=64), nullable=True), sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_comments_post_id'), 'comments', ['post_id'], unique=False) op.create_index(op.f('ix_comments_subreddit_id'), 'comments', ['subreddit_id'], unique=False) op.create_index(op.f('ix_comments_user_id'), 'comments', ['user_id'], unique=False) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('comments', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('post_id', sa.String(length=32), nullable=True), sa.Column('user_id', sa.String(length=64), nullable=True), sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_comments_post_id'), 'comments', ['post_id'], unique=False) op.create_index(op.f('ix_comments_subreddit_id'), 'comments', ['subreddit_id'], unique=False) op.create_index(op.f('ix_comments_user_id'), 'comments', ['user_id'], unique=False) ### end Alembic commands ###
def upgrade_production(): ### commands auto generated by Alembic - please adjust! ### op.create_table('comments', sa.Column('id', sa.String(length=256), autoincrement=False, nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('created_utc', sa.DateTime(), nullable=True), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('post_id', sa.String(length=32), nullable=True), sa.Column('user_id', sa.String(length=64), nullable=True), sa.Column('comment_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_index(op.f('ix_comments_post_id'), 'comments', ['post_id'], unique=False) op.create_index(op.f('ix_comments_subreddit_id'), 'comments', ['subreddit_id'], unique=False) op.create_index(op.f('ix_comments_user_id'), 'comments', ['user_id'], unique=False) ### end Alembic commands ###
def MediumText(): return sql.Text().with_variant(mysql.MEDIUMTEXT(), 'mysql')
def MediumText(): return sql.Text().with_variant(mysql.MEDIUMTEXT(), 'mysql') # Resource Model
def MediumText(): return Text().with_variant(MEDIUMTEXT(), 'mysql')
def upgrade(): if context.config.get_main_option('sqlalchemy.url').startswith('mysql'): op.alter_column(table_name='variable', column_name='val', type_=mysql.MEDIUMTEXT)
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_thing_snapshots', sa.Column('id', sa.Integer(), nullable=False), sa.Column('experiment_thing_id', sa.String(length=256), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_id'), 'experiment_thing_snapshots', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_thing_id'), 'experiment_thing_snapshots', ['experiment_thing_id'], unique=False) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_thing_snapshots', sa.Column('id', sa.Integer(), nullable=False), sa.Column('experiment_thing_id', sa.String(length=256), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_id'), 'experiment_thing_snapshots', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_thing_id'), 'experiment_thing_snapshots', ['experiment_thing_id'], unique=False) ### end Alembic commands ###
def upgrade_production(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_thing_snapshots', sa.Column('id', sa.Integer(), nullable=False), sa.Column('experiment_thing_id', sa.String(length=256), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_id'), 'experiment_thing_snapshots', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_thing_snapshots_experiment_thing_id'), 'experiment_thing_snapshots', ['experiment_thing_id'], unique=False) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('front_pages', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('front_pages', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_actions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('praw_key_id', sa.String(length=256), nullable=True), sa.Column('action_subject_type', sa.String(length=64), nullable=True), sa.Column('action_subject_id', sa.String(length=256), nullable=True), sa.Column('action_object_type', sa.String(length=64), nullable=True), sa.Column('action_object_id', sa.String(length=256), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_actions_action_object_id'), 'experiment_actions', ['action_object_id'], unique=False) op.create_index(op.f('ix_experiment_actions_action_subject_id'), 'experiment_actions', ['action_subject_id'], unique=False) op.create_index(op.f('ix_experiment_actions_experiment_id'), 'experiment_actions', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_actions_praw_key_id'), 'experiment_actions', ['praw_key_id'], unique=False) op.create_table('experiment_things', sa.Column('id', sa.String(length=256), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('object_created', sa.DateTime(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_things_experiment_id'), 'experiment_things', ['experiment_id'], unique=False) op.create_table('experiments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('name', sa.String(length=256), nullable=False), sa.Column('controller', sa.String(length=256), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('end_time', sa.DateTime(), nullable=True), sa.Column('settings_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiments_name'), 'experiments', ['name'], unique=False) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_actions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('praw_key_id', sa.String(length=256), nullable=True), sa.Column('action_subject_type', sa.String(length=64), nullable=True), sa.Column('action_subject_id', sa.String(length=256), nullable=True), sa.Column('action_object_type', sa.String(length=64), nullable=True), sa.Column('action_object_id', sa.String(length=256), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_actions_action_object_id'), 'experiment_actions', ['action_object_id'], unique=False) op.create_index(op.f('ix_experiment_actions_action_subject_id'), 'experiment_actions', ['action_subject_id'], unique=False) op.create_index(op.f('ix_experiment_actions_experiment_id'), 'experiment_actions', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_actions_praw_key_id'), 'experiment_actions', ['praw_key_id'], unique=False) op.create_table('experiment_things', sa.Column('id', sa.String(length=256), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('object_created', sa.DateTime(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_things_experiment_id'), 'experiment_things', ['experiment_id'], unique=False) op.create_table('experiments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('name', sa.String(length=256), nullable=False), sa.Column('controller', sa.String(length=256), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('end_time', sa.DateTime(), nullable=True), sa.Column('settings_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiments_name'), 'experiments', ['name'], unique=False) ### end Alembic commands ###
def upgrade_production(): ### commands auto generated by Alembic - please adjust! ### op.create_table('experiment_actions', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('praw_key_id', sa.String(length=256), nullable=True), sa.Column('action_subject_type', sa.String(length=64), nullable=True), sa.Column('action_subject_id', sa.String(length=256), nullable=True), sa.Column('action_object_type', sa.String(length=64), nullable=True), sa.Column('action_object_id', sa.String(length=256), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_actions_action_object_id'), 'experiment_actions', ['action_object_id'], unique=False) op.create_index(op.f('ix_experiment_actions_action_subject_id'), 'experiment_actions', ['action_subject_id'], unique=False) op.create_index(op.f('ix_experiment_actions_experiment_id'), 'experiment_actions', ['experiment_id'], unique=False) op.create_index(op.f('ix_experiment_actions_praw_key_id'), 'experiment_actions', ['praw_key_id'], unique=False) op.create_table('experiment_things', sa.Column('id', sa.String(length=256), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('object_type', sa.Integer(), nullable=True), sa.Column('experiment_id', sa.Integer(), nullable=True), sa.Column('object_created', sa.DateTime(), nullable=True), sa.Column('metadata_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiment_things_experiment_id'), 'experiment_things', ['experiment_id'], unique=False) op.create_table('experiments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('name', sa.String(length=256), nullable=False), sa.Column('controller', sa.String(length=256), nullable=False), sa.Column('start_time', sa.DateTime(), nullable=True), sa.Column('end_time', sa.DateTime(), nullable=True), sa.Column('settings_json', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_experiments_name'), 'experiments', ['name'], unique=False) ### end Alembic commands ###
def upgrade_development(): ### commands auto generated by Alembic - please adjust! ### op.create_table('subreddit_pages', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('page_type', sa.Integer(), nullable=True), sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('subreddits', sa.Column('id', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('name', sa.String(length=32), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_table('posts', sa.Column('id', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('post_data', mysql.MEDIUMTEXT(), nullable=True), sa.ForeignKeyConstraint(['subreddit_id'], ['subreddits.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.add_column('front_pages', sa.Column('page_type', sa.Integer(), nullable=True)) ### end Alembic commands ###
def upgrade_test(): ### commands auto generated by Alembic - please adjust! ### op.create_table('subreddit_pages', sa.Column('id', sa.Integer(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('page_type', sa.Integer(), nullable=True), sa.Column('page_data', mysql.MEDIUMTEXT(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('subreddits', sa.Column('id', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('name', sa.String(length=32), nullable=True), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.create_table('posts', sa.Column('id', sa.String(length=32), autoincrement=False, nullable=False), sa.Column('subreddit_id', sa.String(length=32), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('post_data', mysql.MEDIUMTEXT(), nullable=True), sa.ForeignKeyConstraint(['subreddit_id'], ['subreddits.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('id') ) op.add_column('front_pages', sa.Column('page_type', sa.Integer(), nullable=True)) ### end Alembic commands ###
def upgrade(): op.alter_column('instance', 'contents', existing_type=mysql.MEDIUMTEXT(collation='utf8_bin'), type_=mysql.LONGTEXT(collation='utf8_bin'), existing_nullable=False)
def downgrade(): op.alter_column('instance', 'contents', existing_type=mysql.LONGTEXT(collation='utf8_bin'), type_=mysql.MEDIUMTEXT(collation='utf8_bin'), existing_nullable=False)