【问题标题】:Error: TypeError: Cannot read property 'Stream' of undefined at AthenaExpress.query错误:TypeError:无法读取 AthenaExpress.query 中未定义的属性“流”
【发布时间】:2021-10-25 09:24:13
【问题描述】:

我正在尝试连接到 AWS Athena 并执行选择查询。我为此使用了 athena-express 包。这是以下错误。

错误:TypeError:无法读取未定义的属性“流” 在 AthenaExpress.query

Here is the sample code:
    
  const AthenaExpress = require("athena-express");
  const aws = require("aws-sdk");
  const awsCredentials = {
  accessKeyId: "AccesskeyHere",
  secretAccessKey: "secretkeyHere",
  region: "regionHere",
 };
 aws.config.update(awsCredentials);

 const athenaExpressConfig = { aws,getStats: true,s3:"s3URI" }; //configuring athena-express with aws sdk object
 const athenaExpress = new AthenaExpress(athenaExpressConfig);

(async () => {
    let query = {
        sql: "SELECT * FROM table where vin='123' and date like '%2021-08%'",
        db: "databasename"
    };

    try {
        let results = await athenaExpress.query(query);
        console.log(results);
    } catch (error) {
        console.log(error);
    }
})();
    
Here is the error:

Error: TypeError: Cannot read property 'Stream' of undefined
    at AthenaExpress.query 
    at async eval

请告诉我如何解决这个问题?

【问题讨论】:

    标签: javascript node.js cypress amazon-athena


    【解决方案1】:

    通过使用分页属性,我可以获得上述结果集

    let query = {
     sql: "SELECT 1",
     db: "databasename",
     pagination: number
    };
    

    您可以参考此链接了解更多关于分页的信息:

    https://github.com/ghdna/athena-express#more-examples

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-12-24
      • 2023-02-26
      • 2017-05-05
      • 2019-04-05
      • 2020-09-03
      • 1970-01-01
      相关资源
      最近更新 更多