Python 0.24读取sql操作错误

Python 0.24读取sql操作错误,python,pandas,sqlalchemy,Python,Pandas,Sqlalchemy,我刚刚从0.23.4(Python 2.7.12)升级到Pandas 0.24.0,我的许多pd.read\u sql查询都被破坏了。它看起来与MySQL有关,但奇怪的是,这些错误只有在更新我的pandas版本后才会发生。知道发生了什么事吗 这是我的MySQL表: CREATE TABLE `xlations_topic_update_status` ( `run_ts` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP ) ENGINE=I

我刚刚从0.23.4(Python 2.7.12)升级到Pandas 0.24.0,我的许多
pd.read\u sql
查询都被破坏了。它看起来与MySQL有关,但奇怪的是,这些错误只有在更新我的pandas版本后才会发生。知道发生了什么事吗

这是我的MySQL表:

CREATE TABLE `xlations_topic_update_status` (
  `run_ts` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
我的问题是:

import pandas as pd
from sqlalchemy import create_engine
db_engine = create_engine('mysql+mysqldb://<><>/product_analytics', echo=False)
pd.read_sql('select max(run_ts) from product_analytics.xlations_topic_update_status', con = db_engine).values[0][0]
我也为其他更复杂的查询得到了这个,但不会在这里发布它们

根据第一个参数,可以是字符串(表名)或SQLAlchemy可选(或对象)。换句话说,就是将整个查询字符串委托给表标识符,并将其视为表标识符

首先将查询字符串包装在构造中:

stmt = text('select max(run_ts) from product_analytics.xlations_topic_update_status')
pd.read_sql(stmt, con = db_engine).values[0][0]
这种方式将改为委托给。另一个选项是直接调用它。

根据第一个参数,可以是字符串(表名)或SQLAlchemy可选(或对象)。换句话说,就是将整个查询字符串委托给表标识符,并将其视为表标识符

首先将查询字符串包装在构造中:

stmt = text('select max(run_ts) from product_analytics.xlations_topic_update_status')
pd.read_sql(stmt, con = db_engine).values[0][0]

这种方式将改为委托给。另一种选择是直接调用它。

尝试使用
pd.read\u sql\u查询(sql,con)
,而不是
pd.read\u sql(…)

因此:


尝试使用
pd.read\u sql\u查询(sql,con)
,而不是
pd.read\u sql(…)

因此:


可能是因为您只在read\u sql字符串的末尾使用分号,而不应该使用分号吗?不,我尝试删除分号可能是因为您只在read\u sql字符串的末尾使用分号,而不应该使用分号吗?不,我尝试删除分号
pd.read_sql_query('select max(run_ts) from product_analytics.xlations_topic_update_status', con = db_engine).values[0][0]