Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sqlalchemy function for default value for column

def mydefault(context):
    return context.get_current_parameters()['counter'] + 12

t = Table('mytable', meta,
    Column('counter', Integer),
    Column('counter_plus_twelve', Integer, default=mydefault, onupdate=mydefault)
)
Source by docs.sqlalchemy.org #
 
PREVIOUS NEXT
Tagged: #sqlalchemy #function #default #column
ADD COMMENT
Topic
Name
5+2 =