我正在阅读这样一个表:
query = (
"select mandant,posnr,systemdat,
"lieferbedingung,loeschhafen,bereich,"
"nrkreis_nr from eakopf_t where posnr[10,10] = " " and posnr[1,2] not in ("99","RE","UB") and mandant <> 999;"
)
df = pd.read_sql(query, engine.connect())
但是我得到这个错误:
ibm_db_dbi::DatabaseError: SQLNumResultCols failed: [IBM][CLI Driver][IDS/UNIX64] Column ( ) not found in any table in the query (or SLV is undefined). SQLCODE=-217
[SQL: select mandant,posnr,systemdat,lieferbedingung,loeschhafen,bereich,nrkreis_nr from eakopf_t where posnr[10,10] = " " and posnr[1,2] not in ("99","RE","UB") and mandant <> 999;]
是否有可能进一步调试哪个是导致问题的确切col ?否则,所有的colname似乎都存在于数据集中。
有点像猜测,因为我看不到你的数据库,但是这一行:
posnr[10,10] = " "
对我来说是可疑的。至少在Postgres中,双引号表示列名,这会给您这样的错误。我建议用单引号替换任何表示字符串的双引号,然后再试一次。ie)
posnr[10,10] = ' '