summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql
diff options
context:
space:
mode:
authormike bayer <mike_mp@zzzcomputing.com>2022-06-10 18:18:35 +0000
committerGerrit Code Review <gerrit@ci3.zzzcomputing.com>2022-06-10 18:18:35 +0000
commit6bbc1ef1e9cdb38b3697b42272355b164f0f0242 (patch)
tree50bce6705b35077314f0c543e1c75f0a82318473 /lib/sqlalchemy/sql
parentf003360baa28f1bf65134eac2727a0fcea43d5c8 (diff)
parentbc0367c670cc1376b90ab2309085bd660ec317c9 (diff)
downloadsqlalchemy-6bbc1ef1e9cdb38b3697b42272355b164f0f0242.tar.gz
Merge "resolve large ints to BigInteger" into main
Diffstat (limited to 'lib/sqlalchemy/sql')
-rw-r--r--lib/sqlalchemy/sql/sqltypes.py7
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()