SQLAlchemy common data types:

1. Integer : shaping, is mapped to the database int.

2. Float : floating-point type, the database is mapped to a float. 32 it occupies.

3. Double : double precision floating point type, mapped into the database type double, occupy 64 bits.

4. String : variable character type, are mapped to the database type varchar.

5. The Boolean : Boolean type, are mapped to the database tinyint type.

6. DECIMAL : fixed-point types. Floating-point type is designed to solve the problem of loss of precision. When storing money in related fields suggest that you use this data type. And when the transmission of this type requires the use of two parameters, the first parameter is used to mark the total number digits field can store energy, the second parameter indicates the number of decimal places.

7. the Enum : enumerated types. Specify a field only a few enum values specified, not value for others. In the ORM model, we use Enum as enumeration.

8. a Date : storage time, can only store date. Mapping to the database is date type. In Python code, you may be used to specify the `datetime.date`.

9. The the DateTime : storage time, year, month, day, hour may be stored when milliseconds and the like. The database is mapped to datetime type. In Python code, you may be used to specify the `datetime.datetime`.

10. The Time : Hour Minute Second storage time may be stored. Mapped to a database is time types. In Python code, you may be used to specify the `datetime.time`.

11. The the Text : store long strings. 6W general can store multiple characters. If you exceed this range, you can use LONGTEXT type. Mapping to the database type is text.

12. The LONGTEXT : long text type, are mapped to the database longtext type.

Guess you like

Origin www.cnblogs.com/sheng-yang/p/10890832.html