flask框架创建数据库定义字段类型和字段常用参数
1、字段類型
Integer int整型,普通整數(shù),一般是32位
SmallInteger int 取值范圍最小的整型,一般是16位
Big Integer int或long 不限制精度的整數(shù)
Float float浮點型
String str 不定長字符串類型
Text str文本 變長字符串,對較大或不限長度的字符串做了優(yōu)化
Unicode unicode變長unicode字符串
#unicode采用雙字節(jié)對字節(jié)進行編碼
unicode Text unicode 變長Unicode字符串,對較長或不限長度的字符串做了優(yōu)化
Boolean bool布爾值
Date datatime.date日期
Time datetime.time時間類型時分秒
DateTime datetime.datetme時間類型,年月日時分秒
Interval datetime.timedelta時間間隔
Enum str一組字符串
PickleType 任何Python對象自動使用Pickle序列化
LargeBinary str二進制文件
2、字段常用的參數(shù)
primary_key 主鍵
Unique不重復(fù),唯一
Index 索引
Nullable如果為True是可以為空
Default默認值
Autoincrement自增長
總結(jié)
以上是生活随笔為你收集整理的flask框架创建数据库定义字段类型和字段常用参数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: flask框架数据库增删改查
- 下一篇: flask双向映射语法