点击此处---> 群内免费提供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(?,?)',(数据,输出))
您好,Arunkumar KP,hana_ml库可以将Pandas数据框上传到HANA。 它以必要的格式创建表并保留数据。 Witalij Rudnicki 在他的博客 https://blogs.sap.com/2020/03/11/quickly-load -covid-19-data-with-hana_ml-and-see-with-dbeaver /
此处 https://help.sap.com/doc/1d0ebfe5e8dd44d09606814d83308d4b/ US/hana_ml.dataframe.html#hana_ml.dataframe.create_dataframe_from_pandas
Christoph Morgen http s://blogs.sap.com/2020/02/24/updates-for-the-data-scientist-building-sap-hana-embedded-machine-learning-scenarios-from-python-or-r /
请向您的客户经理确认您的HANA许可是否允许这种用法。
许多问候Andreas
感谢您访问SAP社区以获取问题的答案。 由于您是第一次在这里提出问题,因此建议您熟悉 https ://community.sap.com/resources/questions-and-answers (如果您还没有的话),因为它提供了准备问题的技巧,这些问题引起了我们成员的回响。
如果您愿意,可以先选择"操作",然后再"编辑"来修改您的问题(尽管一旦有人回答了您的问题,您将失去编辑问题的能力-但是,如果发生这种情况,您可以在" 评论)。
-Jerry
亲爱的Arunkumar
实际上,DB过程应该使用table [],而不是数据字符串。
所以您可能不得不写这样的东西
感谢 Venkateswaran Krishnamurthy 。这不是一种 表,它是HANA中的一种表类型
表类型数据是从UI以JSON格式提供的,我们在python脚本中使用了表数据,所以我的问题更像是从python脚本发送此输入到过程,第一个参数接受表类型值,我需要 将收到的JSON输入转换为表类型
一周热门 更多>