Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLAlchemy decimal precision

The documentation at sqlalchemy gives an example:

class sqlalchemy.types.DECIMAL(precision=None, scale=None, asdecimal=True)

What values other than None can you use for precision? I don't really understand how to set up the decimal precision.

like image 511
Darc Nawg Avatar asked Jan 09 '15 21:01

Darc Nawg


1 Answers

From documentation

precision – the numeric precision for use in DDL CREATE TABLE

If you want to know which values are possible, check W3Schools for SQL data types: http://www.w3schools.com/sql/sql_datatypes_general.asp

In this case:

DECIMAL(p,s): Exact numerical, precision p, scale s. Example: decimal(5,2) is a number that has 3 digits before the decimal and 2 digits after the decimal

like image 82
Leandro Carracedo Avatar answered Oct 10 '22 05:10

Leandro Carracedo