Python sqlalchemy 模块,Time() 实例源码
我们从Python开源项目中,提取了以下3个代码示例,用于说明如何使用sqlalchemy.Time()。
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('event', sa.Column('finishTime', sa.Time(), nullable=True))
op.add_column('event', sa.Column('startTime', nullable=True))
# ### end Alembic commands ###
def __str__(self):
'''
Method for pretty printing
'''
return '\n'.join(['Content: ' + str(self.content),
'Author: ' + str(self.author),
'Posting Date: ' + str(self.posting_date),
'To: ' + str(self.to),
'From: ' + str(self.frm),
'Time: ' + str(self.time),
'Date: ' + str(self.date),
'PostId: ' + str(self.post_id)
])
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.create_table('reviews',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('movie_id', nullable=True),
sa.Column('movie_title', sa.String(),
sa.Column('image_path',
sa.Column('movie_review',
sa.Column('posted',
sa.Column('user_id',
sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
sa.PrimaryKeyConstraint('id')
)
# ### end Alembic commands ###