我正在尝试使用 SQLAlchemy 对现有数据库进行建模,并且非常接近。
我的症结在于 FLOAT 类型。
在 MySQL 数据库中它们是Float(10,2)
使用 SQLAlchemy,无论我如何尝试创建它们,我都无法复制它。
例子有:
from sqlalchemy.dialects.mysql import FLOAT
from sqlalchemy.ext.declarative import declarative_base
connection_string = 'xxxxx'
engine = create_engine(connection_string, echo=True, encoding='utf-8')
Base = declarative_base(engine)
class TestTable(Base):
__tablename__ = 'my_test_table'
float_1 = Column(FLOAT(length=10, precision=2))
float_2 = Column(Float(10,2))
float_3 = Column(Float(as_decimal=True))
Run Code Online (Sandbox Code Playgroud) 我有一个表incoming,其中包含电子邮件列表及其附件。
我导入每个附件并处理它们,此时该行被标记为5
当单个电子邮件的所有行都标记为 5 时,我可以移动/删除该电子邮件,因为它已被正确处理。
但是,我正在努力编写一个 SQL 查询,该查询要选择msg_uid具有相同msg_uid状态的所有行5
示例表
-----------------------------------------------------
| id | STATUS | i2d_id | msg_uid | i2d_msg |
-----------------------------------------------------
| 16 | 5 | 98390 | 53 | Result is ready. |
-----------------------------------------------------
| 17 | 3 | 98391 | 53 | Result is ready. |
-----------------------------------------------------
| 18 | 5 | 98392 | 53 | Result is ready. |
-----------------------------------------------------
| 19 | 3 | 98393 | 53 …Run Code Online (Sandbox Code Playgroud)