[英]IBM Watson Assistant: How to make query result from Db2 downloadable as CSV file?
I am writing a chatbot program with IBM Watson Assistant in Node.js with Db2 and was wondering if there was a way to add my query results in a CSV file?我正在用 Node.js 和 Db2 在 Node.js 中编写一个聊天机器人程序,我想知道是否有办法将我的查询结果添加到 CSV 文件中?
The csv file will then be downloaded by the user.然后用户将下载 csv 文件。
var data = conn.querySync('SELECT DISTINCT "Commodity" FROM TRADES WHERE "Aggregate_Level"=2');
I did some research and most that i found was codes for the command line interface.我做了一些研究,发现的大部分是命令行界面的代码。
There are libraries to generate all kind of file types, including a CSV file.有一些库可以生成各种文件类型,包括 CSV 文件。 It is done by your app from the query result.
它是由您的应用从查询结果中完成的。
In Watson Assistant, you cannot upload or pass through files.在 Watson Assistant 中,您无法上传或传递文件。 But you can respond with a link to where a file is stored.
但是您可以使用指向文件存储位置的链接进行响应。 The file could be in Cloud Object Storage (COS) or somewhere else.
该文件可能位于 Cloud Object 存储 (COS) 或其他位置。
To get your data from Db2 accessible in the chatbot,要从聊天机器人中访问的 Db2 获取您的数据,
The user could then click the link to download the file.然后用户可以单击链接下载文件。
The IBM Cloud solution tutorials have instructions and code for all of the above, but not within a single tutorial. IBM Cloud 解决方案教程包含上述所有内容的说明和代码,但不在一个教程中。 Look for "secure file storage" and for "database-driven chatbot" as a starter.
寻找“安全文件存储”和“数据库驱动的聊天机器人”作为入门。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.