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.INTEGER(), nullable=False),
    sa.Column('from_user_id', sa.INTEGER(), nullable=True),
    sa.Column('to_user_id', sa.INTEGER(), nullable=True),
    sa.Column('subject', sa.VARCHAR(length=255), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('date_created', sa.DATETIME(), nullable=True),
    sa.Column('trash', sa.BOOLEAN(), nullable=False),
    sa.Column('draft', sa.BOOLEAN(), nullable=False),
    sa.Column('unread', sa.BOOLEAN(), nullable=False),
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['user_id'], [u'users.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.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), nullable=False),
    sa.Column('from_user_id', sa.INTEGER(), nullable=True),
    sa.Column('to_user_id', sa.INTEGER(), nullable=True),
    sa.Column('subject', sa.VARCHAR(length=255), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('date_created', sa.DATETIME(), nullable=True),
    sa.Column('trash', sa.BOOLEAN(), nullable=False),
    sa.Column('draft', sa.BOOLEAN(), nullable=False),
    sa.Column('unread', sa.BOOLEAN(), nullable=False),
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['user_id'], [u'users.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.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('user_id', sa.INTEGER(), nullable=False),
    sa.Column('from_user_id', sa.INTEGER(), nullable=True),
    sa.Column('to_user_id', sa.INTEGER(), nullable=True),
    sa.Column('subject', sa.VARCHAR(length=255), nullable=True),
    sa.Column('message', sa.TEXT(), nullable=True),
    sa.Column('date_created', sa.DATETIME(), nullable=True),
    sa.Column('trash', sa.BOOLEAN(), nullable=False),
    sa.Column('draft', sa.BOOLEAN(), nullable=False),
    sa.Column('unread', sa.BOOLEAN(), nullable=False),
    sa.ForeignKeyConstraint(['from_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['to_user_id'], [u'users.id'], ),
    sa.ForeignKeyConstraint(['user_id'], [u'users.id'], ),
    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('id', sa.INTEGER(), nullable=False),
    sa.Column('search_terms', sa.VARCHAR(length=64), nullable=False),
    sa.Column('timestamp', sa.DATETIME(), nullable=True),
    sa.Column('user_id', sa.INTEGER(), nullable=True),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.INTEGER(), nullable=False),
    sa.Column('social_id', sa.VARCHAR(length=64), nullable=False),
    sa.Column('nickname', sa.VARCHAR(length=64), nullable=False),
    sa.Column('email', sa.VARCHAR(length=64), nullable=True),
    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', sa.DATETIME(), nullable=True))
    op.add_column('schedule_task', sa.Column('total_run_count', sa.INTEGER(), 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(), nullable=False),
                    sa.Column('sha512_hash', sa.TEXT(), nullable=True),
                    sa.Column('sha256_hash', sa.TEXT(), nullable=True),
                    sa.Column('sha1_hash', sa.TEXT(), nullable=True),
                    sa.Column('md5_hash', sa.TEXT(), nullable=True),
                    sa.Column('size', sa.FLOAT(), nullable=True),
                    sa.Column('mime_type', sa.VARCHAR(length=120),
                              nullable=True),
                    sa.Column('submitted_by', sa.VARCHAR(length=120),
                              nullable=False),
                    sa.Column('status', sa.VARCHAR(length=20), nullable=False),
                    sa.Column('last_updated', sa.DATETIME(), nullable=False),
                    sa.Column('first_seen', sa.DATETIME(), nullable=False),
                    sa.PrimaryKeyConstraint('file_id')
                    )
    op.create_table('lookup_request',
                    sa.Column('request_id', sa.BIGINT(), nullable=False),
                    sa.Column('requested_at', sa.DATETIME(), nullable=False),
                    sa.Column('requestor', sa.VARCHAR(length=120),
                              nullable=False),
                    sa.Column('file_id', sa.BIGINT(), nullable=True),
                    sa.Column('lookup_hash', sa.TEXT(), nullable=False),
                    sa.Column('result', sa.VARCHAR(length=20), nullable=False),
                    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, nullable=False),
        sa.Column('$Volume', sa.INTEGER, nullable=False),
        sa.Column('LowPrice', sa.INTEGER, nullable=False),
        sa.Column('HighPrice', sa.INTEGER, nullable=False),
        sa.Column('AvgPrice', sa.DECIMAL, nullable=False),
        sa.Column('LastPrice', sa.INTEGER, nullable=True),  # 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('id', sa.INTEGER(), nullable=False),
    sa.Column('body', sa.VARCHAR(), nullable=True),
    sa.Column('created', sa.DATETIME(), nullable=True),
    sa.Column('post_id', sa.INTEGER(), nullable=True),
    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 ###