diff options
| author | mike bayer <mike_mp@zzzcomputing.com> | 2022-06-10 18:18:35 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@ci3.zzzcomputing.com> | 2022-06-10 18:18:35 +0000 |
| commit | 6bbc1ef1e9cdb38b3697b42272355b164f0f0242 (patch) | |
| tree | 50bce6705b35077314f0c543e1c75f0a82318473 /lib/sqlalchemy/sql | |
| parent | f003360baa28f1bf65134eac2727a0fcea43d5c8 (diff) | |
| parent | bc0367c670cc1376b90ab2309085bd660ec317c9 (diff) | |
| download | sqlalchemy-6bbc1ef1e9cdb38b3697b42272355b164f0f0242.tar.gz | |
Merge "resolve large ints to BigInteger" into main
Diffstat (limited to 'lib/sqlalchemy/sql')
| -rw-r--r-- | lib/sqlalchemy/sql/sqltypes.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sqlalchemy/sql/sqltypes.py b/lib/sqlalchemy/sql/sqltypes.py index 50cb32503..2cc46107b 100644 --- a/lib/sqlalchemy/sql/sqltypes.py +++ b/lib/sqlalchemy/sql/sqltypes.py @@ -366,6 +366,12 @@ class Integer(HasExpressionLookup, TypeEngine[int]): def python_type(self): return int + def _resolve_for_literal(self, value): + if value.bit_length() >= 32: + return _BIGINTEGER + else: + return self + def literal_processor(self, dialect): def process(value): return str(int(value)) @@ -3556,6 +3562,7 @@ MATCHTYPE = MatchType() TABLEVALUE = TableValueType() DATETIME_TIMEZONE = DateTime(timezone=True) TIME_TIMEZONE = Time(timezone=True) +_BIGINTEGER = BigInteger() _DATETIME = DateTime() _TIME = Time() _STRING = String() |
