从python sqlalchemy调用过程时出错

2020-08-22 05:37发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)嗨 当我使用sqlalchem...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


当我使用sqlalchemy lib从表类型输入和python的varchar out参数调用存储过程时遇到错误。以下是错误

从python sqlalchemy.exc.DatabaseError调用过程时出错:(pyhdb.exceptions.DatabaseError)无效参数:输入参数不足以作为表参数:

第一个参数是表类型,第二个参数是varchar

我正在添加尝试使用的代码段

 engine = create_engine(" hana + pyhdb://{username}:{password} @ {host}:{port}"。format(username ='username',password ='password',host ='hostname'  ,port ='30015'))
 output ="
 数据='[{" RULE_ID":1," RULE_NAME":null," SO_SSA":" 1074"," PO_NUMBER":null," CODE":" DDD"," ROUTE_CODE":""," OPERATING":  null," SHIP_TO":" IND"," SHIP_TO_REGION":" MX"," SHIP_TO_CUSTOMER_ID":null," BILL_TO_CUSTOMER_ID":null," END_TO_CUSTOMER_ID":null," SLCA":" AKP123"," HOLD_NAME":" 批准保留"," SHIPPING_PREFERENCE":null," EAD":null," CUSTOMER_REQUEST_TYPE":null," CRD":null," CRSD":null," CURRENT_PROMISE_DATE":null," CURRENT_PROMISE_DELIVERY_DATE"" ATE:null"  null," OPDD":null," ON_HOLD":null," FLOW_STATUS_CODE":null," PICK_RESULT":null," IS_IN_OTM":null," BUSINESS_UNIT":null," REVENUE_FLAG":null," ACTION_CATEGORY":null,  " ACTION_OWNER":null," SS_REVENUE":null," CARTONS":null," INVOICE_ELIGIBILITY_EVENT":null," SALES_CHANNEL":null," CREATED_BY":" NEW"," CREATION_DATE":" 2020-02-11 10:  24PM"," LAST_UPDATED_BY":" NEW"," LAST_UPDATE_DATE":" 2020-03-04 10:39 PM"," FDA_FLAG":null," POE_FLAG":null," CONSOLIDATED_FLAG":null," START_DATE":" 2019  -01-02"," END_DATE":" 2020-01-02"," ACTIVE":" T"}]]'

 test = engine.execute('call SCHEMA.PROC(?,?)',(数据,输出))
 
4条回答
土豆飞人
2020-08-22 06:19

感谢 Venkateswaran Krishnamurthy 。这不是一种 表,它是HANA中的一种表类型

表类型数据是从UI以JSON格式提供的,我们在python脚本中使用了表数据,所以我的问题更像是从python脚本发送此输入到过程,第一个参数接受表类型值,我需要 将收到的JSON输入转换为表类型

一周热门 更多>