#NEWLINE# def upgrade( ) : #NEWLINE# #INDENT# op . add_column ( 'UserUsedExperiment' , sa . Column ( 'start_date_month' , sa . Integer ( ) , nullable = True ) ) #NEWLINE# op . add_column ( 'UserUsedExperiment' , sa . Column ( 'start_date_week_monday' , sa . Integer ( ) , nullable = True ) ) #NEWLINE# op . add_column ( 'UserUsedExperiment' , sa . Column ( 'start_date_week_sunday' , sa . Integer ( ) , nullable = True ) ) #NEWLINE# op . add_column ( 'UserUsedExperiment' , sa . Column ( 'start_date_year' , sa . Integer ( ) , nullable = True ) ) #NEWLINE# op . create_index ( 'ix_UserUsedExperiment_start_date_month' , 'UserUsedExperiment' , [ 'start_date_month' ] , unique = False ) #NEWLINE# op . create_index ( 'ix_UserUsedExperiment_start_date_week_monday' , 'UserUsedExperiment' , [ 'start_date_week_monday' ] , unique = False ) #NEWLINE# op . create_index ( 'ix_UserUsedExperiment_start_date_week_sunday' , 'UserUsedExperiment' , [ 'start_date_week_sunday' ] , unique = False ) #NEWLINE# op . create_index ( 'ix_UserUsedExperiment_start_date_year' , 'UserUsedExperiment' , [ 'start_date_year' ] , unique = False ) #NEWLINE# s = sql . select ( [ uue . c . id , uue . c . start_date_date ] ) . order_by ( uue . c . id ) #NEWLINE# for use in op . get_bind ( ) . execute ( s ) : #NEWLINE# #INDENT# use_id = use [ uue . c . id ] #NEWLINE# kwargs = { #NEWLINE# #INDENT# 'start_date_month' : use [ uue . c . start_date_date ] . month , #NEWLINE# 'start_date_year' : use [ uue . c . start_date_date ] . year , #NEWLINE# 'start_date_week_sunday' : ( ( use [ uue . c . start_date_date ] - datetime . date ( 1970 , 1 , 4 ) ) . days / 7 ) , #NEWLINE# 'start_date_week_monday' : ( ( use [ uue . c . start_date_date ] - datetime . date ( 1970 , 1 , 5 ) ) . days / 7 ) , #NEWLINE# #UNINDENT# } #NEWLINE# update_stmt = uue . update ( ) . where ( ( uue . c . id == use_id ) ) . values ( ** kwargs ) #NEWLINE# op . execute ( update_stmt )