from sqlalchemy.sql.visitors import Visitable
from sqlalchemy import util
from sqlalchemy import processors
+import collections
NoneType = type(None)
if util.jython:
@util.memoized_property
def _expression_adaptations(self):
+ # TODO: need a dictionary object that will
+ # handle operators generically here, this is incomplete
return {
operators.add:{
Date:Date,
+ Integer:Integer,
+ Numeric:Numeric,
},
operators.mul:{
- Interval:Interval
+ Interval:Interval,
+ Integer:Integer,
+ Numeric:Numeric,
+ },
+ # Py2K
+ operators.div:{
+ Integer:Integer,
+ Numeric:Numeric,
+ },
+ # end Py2K
+ operators.truediv:{
+ Integer:Integer,
+ Numeric:Numeric,
+ },
+ operators.sub:{
+ Integer:Integer,
+ Numeric:Numeric,
},
}
expr = func.current_date() - column('foo', types.TIMESTAMP)
eq_(expr.type._type_affinity, types.Interval)
+
+ def test_expression_typing(self):
+ expr = column('bar', Integer) - 3
+
+ eq_(expr.type._type_affinity, Integer)
def test_distinct(self):
s = select([distinct(test_table.c.avalue)])