Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sqlalchemy function for default value for column

# a function which counts upwards
i = 0
def mydefault():
    global i
    i += 1
    return i

t = Table("mytable", meta,
    Column('id', Integer, primary_key=True, default=mydefault),
)
Source by docs.sqlalchemy.org #
 
PREVIOUS NEXT
Tagged: #sqlalchemy #function #default #column
ADD COMMENT
Topic
Name
9+4 =