node-athena icon indicating copy to clipboard operation
node-athena copied to clipboard

Retrieving results after creating a CTAS table

Open saulimus opened this issue 5 years ago • 2 comments

I would want to get query results after I have created a CTAS table with skipFetchResult = true. I tried creating a new client with a different client config, excluding the skipFetchResult setting. However, after using the new client I still do not get any results.

saulimus avatar Feb 26 '19 10:02 saulimus

Sorry for the late reply.

It is the result of executing with the following sample.

const ctasClient = athena.createClient({
    bucketUri: 'xxx',
    skipFetchResult: true,
},{
    region: 'xxx'
})
ctasClient.execute("select 1", (err, result) => console.log(result.records))

const client = athena.createClient({
    bucketUri: 'xxx',
},{
    region: 'xxx'
})
client.execute("select 1", (err, result) => console.log(result.records))

Result

[]
[ Row { _col0: '1' } ]

Although the above results seem to work properly, are there any samples that cause problems?

KoteiIto avatar Apr 11 '19 15:04 KoteiIto

Sorry I'm not able to provide real example code right now. But the idea is to create first a table using CTAS client, eg. : CREATE TABLE test AS ( select 1 as col1 ); And afterwards try to select from it using the normal client. (because CTAS client will skip result fetch). If the query works fine then I guess I need to make a real example from my project...

saulimus avatar Apr 11 '19 19:04 saulimus