我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用sqlalchemy.DATE。
def downgrade(): ### commands auto generated by Alembic - please adjust! ### op.create_table('housing_evals', sa.Column('id', sa.INTEGER(), nullable=False), sa.Column('uid', sa.VARCHAR(length=32), nullable=False), sa.Column('social_attended', sa.TEXT(), nullable=False), sa.Column('social_hosted', sa.TEXT(), nullable=False), sa.Column('technical_attended', sa.TEXT(), nullable=False), sa.Column('technical_hosted', sa.TEXT(), nullable=False), sa.Column('projects', sa.TEXT(), nullable=False), sa.Column('comments', sa.TEXT(), nullable=False), sa.Column('points', sa.INTEGER(), nullable=False), sa.Column('active', sa.BOOLEAN(), nullable=False), sa.Column('date_created', sa.DATE(), nullable=False), sa.PrimaryKeyConstraint('id') ) ### end Alembic commands ###
def bundles_table(metadata): mkt_id_fk = sa.ForeignKey(MARKETS + '.' + ID) return sa.Table( BUNDLES, metadata, sa.Column(ID, sa.INTEGER, primary_key=True, nullable=False), sa.Column(MARKET_ID, sa.INTEGER, mkt_id_fk, nullable=False), sa.Column(OPEN_DATE, sa.DATE, nullable=False), sa.Column(EXPIRY_DATE, sa.DATE, nullable=False), sa.Column(LIQUIDATION_DATE, sa.DATE, nullable=True), )