问题是,由于某些原因,来自数据库的值不是int,而是decimal.Decimal。我怀疑这链接到我使用的BigInteger类(来自MySQL方言,而不是来自SQLAlchemy的BIGINT,因为我需要设置unsigned参数)。你知道如何以int而不是decimal.Decimal的形式从数据库中获取值吗?下面是我目前的实现: class B64ID(types.TypeDecorator):
impl = BIGINT # from sqlalchemy.dialect
我在MySQL中看到了一些与用户创建的函数相关的奇怪行为。我会尽量简化这件事。现在,我创建了一个函数来执行这个除法,并调用该函数:mysql> create function myd(var decimal) returns decimallanguage sql deterministic -> declare res decimal;
-> set res