Tim Tisdall
Tim Tisdall

Reputation: 10382

SQLAlchemy - proper way to create unsigned BigInteger

I'm getting a warning now that passing arguments to BigInteger is deprecated. However, I'm not sure of any other way to declare the value as unsigned. I'm storing the result of MySQL's uuid_short() function which is an unsigned 64-bit integer which will likely cause an overflow if the column is not declared as UNSIGNED.

What's the proper way of handling this issue now?

Upvotes: 4

Views: 5109

Answers (2)

jbub
jbub

Reputation: 2665

from https://groups.google.com/forum/#!topic/sqlalchemy/L3otXINq6Ts :

you can use from sqlalchemy.dialects.mysql import BIGINT

Upvotes: 6

user1301404
user1301404

Reputation:

I'm not familiar quite much with SQLAlchemy. Anyway, as I remember you can set an unsigned integer the following way:

from sqlalchemy.dialects.mysql import INTEGER
Column(INTEGER(unsigned=True))

or just

from sqlalchemy.dialects.mysql import INTEGER as Integer
Column(Integer(unsigned=True))

The same applies to BIGINT.

Upvotes: 5

Related Questions