-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integer of higher length than 11 #18
Comments
The clue here is that it's out of range, 32 bit ints will never be longer than 11 digits (when you include negatives). You need bigints / longs. |
Please ignore. Realised this is due to the max size of int, and nothing to do with Pony. My bad. |
Just in case, this is how you can specify bigint column in Pony: db = Database(...)
class MyEntity(db.Entity):
attr1 = Required(int) # Usual INT column
attr2 = Required(long) # BIGINT column
attr3 = Required(int, sql_type='BIGINT') # alternative way |
@kozlovsky, There is no Also, documentation update is required |
The resulting error is not silent, the exception I'm not sure about deprecation. For projects where porting to Python 3 is not planned, using
I need to think a bit more about this topic. |
Nice to listen to you! Please note:
|
It seems that you should write Pyton2 to Python3 migration guide in documentation, and specify that undetectable problem (at least). |
maybe |
We deprecated For the attr1 = Required(int, size=8) # 8 bit - TINYINT in MySQL
attr2 = Required(int, size=16) # 16 bit - SMALLINT in MySQL
attr3 = Required(int, size=24) # 24 bit - MEDIUMINT in MySQL
attr4 = Required(int, size=32) # 32 bit - INTEGER in MySQL
attr5 = Required(int, size=64) # 64 bit - BIGINT in MySQL You can use the
The default value of the If current database does not support specified attribute size, the next bigger size is used. For example, PostgreSQL does not have Only MySQL actually supports unsigned types. For other databases the column will use signed numeric type which can hold all valid values for the specified unsigned type. For example, in PostgreSQL an unsigned attribute with size 16 will use When size is specified, Pony automatically assigns Starting with the Pony release 0.6 the |
@socketpair, we just make Pony ORM 0.6 Release Candidate 3, if you think that the |
As I see (I did no check), |
I can't seem to find a way for pony to specify a db int field with a length > 11, so if I try and insert something longer than 11 digits, I get:
cannot be stored in the database. DataError: 1264 Out of range value for column 'xxx' at row 1
If I increase the column length manually of the database column, the same problem persists. Any ideas / suggestions?
The text was updated successfully, but these errors were encountered: