Python sqlalchemy 模块-DATETIME 实例源码

Python sqlalchemy 模块,DATETIME 实例源码

我们从Python开源项目中,提取了以下8代码示例,用于说明如何使用sqlalchemy.DATETIME

项目:pyt    作者:python-security    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('privatemessages',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id',
    sa.Column('from_user_id', nullable=True),
    sa.Column('to_user_id',
    sa.Column('subject', sa.VARCHAR(length=255),
    sa.Column('message', sa.TEXT(),
    sa.Column('date_created', sa.DATETIME(),
    sa.Column('trash', sa.BOOLEAN(),
    sa.Column('draft',
    sa.Column('unread',
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'],
    sa.ForeignKeyConstraint(['user_id'],
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('messages')
    op.drop_table('conversations')
    ### end Alembic commands ###
项目:pyt    作者:python-security    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('privatemessages',
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('messages')
    op.drop_table('conversations')
    ### end Alembic commands ###
项目:pyt    作者:python-security    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('privatemessages',
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_table('messages')
    op.drop_table('conversations')
    ### end Alembic commands ###
项目:mensa-tracker    作者:annyanich    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('searches',
    sa.Column('search_terms', sa.VARCHAR(length=64),
    sa.Column('timestamp', ['users.id'],
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('social_id',
    sa.Column('nickname',
    sa.Column('email',
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('social_id')
    )
    ### end Alembic commands ###
项目:flask-celery3-boilerplate    作者:sdg32    | 项目源码 | 文件源码
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('schedule_task', sa.Column('last_run_at', nullable=True))
    op.add_column('schedule_task', sa.Column('total_run_count', nullable=True))
    op.drop_table('schedule_Meta')
    op.drop_table('schedule_info')
    # ### end Alembic commands ###
项目:nemesis    作者:openstack    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('file',
                    sa.Column('file_id', sa.BIGINT(),
                    sa.Column('sha512_hash',
                    sa.Column('sha256_hash',
                    sa.Column('sha1_hash',
                    sa.Column('md5_hash',
                    sa.Column('size', sa.FLOAT(),
                    sa.Column('mime_type', sa.VARCHAR(length=120),
                              nullable=True),
                    sa.Column('submitted_by',
                              nullable=False),
                    sa.Column('status', sa.VARCHAR(length=20),
                    sa.Column('last_updated',
                    sa.Column('first_seen',
                    sa.PrimaryKeyConstraint('file_id')
                    )
    op.create_table('lookup_request',
                    sa.Column('request_id',
                    sa.Column('requested_at',
                    sa.Column('requestor',
                    sa.Column('lookup_hash',
                    sa.Column('result',
                    sa.ForeignKeyConstraint(['file_id'], ['file.file_id'],
                    sa.PrimaryKeyConstraint('request_id')
                    )
    # ### end Alembic commands ###
项目:pyiem    作者:rheineke    | 项目源码 | 文件源码
def daily_market_table(Metadata, market):
    table_name = history_key(market)
    # Index columns
    date_col = sa.Column('Date', sa.DATETIME, nullable=False)
    asset_col = sa.Column(
        config.ASSET_ID,
        sa.INTEGER,
        sa.ForeignKey(config.ASSETS + '.' + config.ID),
        nullable=False
    )

    return sa.Table(
        table_name,
        Metadata,
        date_col,
        asset_col,
        sa.Column('Units', sa.INTEGER,
        sa.Column('$Volume',
        sa.Column('LowPrice',
        sa.Column('HighPrice',
        sa.Column('AvgPrice', sa.DECIMAL,
        sa.Column('LastPrice',  # Null == NaN?
        sa.Index('idx', asset_col, date_col, unique=True),
    )
项目:Flask_Bootstrap_Blog    作者:Tim9Liu9    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comment',
    sa.Column('body', sa.VARCHAR(),
    sa.Column('created',
    sa.Column('post_id',
    sa.ForeignKeyConstraint(['post_id'], [u'posts.id'],
    sa.PrimaryKeyConstraint('id')
    )
    op.drop_index(op.f('ix_comments_created'), table_name='comments')
    op.drop_table('comments')
    ### end Alembic commands ###

相关文章

Python setuptools.dep_util 模块,newer_pairwise_group() ...
Python chainer.utils.type_check 模块,eval() 实例源码 我...
Python chainer.utils.type_check 模块,prod() 实例源码 我...
Python chainer.utils.type_check 模块,expect() 实例源码 ...
Python multiprocessing.managers 模块,BaseProxy() 实例源...
Python multiprocessing.managers 模块,RemoteError() 实例...