KoteiIto / node-athena

a nodejs simple aws athena client
MIT License
105 stars 73 forks source link

Retrieving results after creating a CTAS table #47

Open saulimus opened 5 years ago

saulimus commented 5 years ago

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.

KoteiIto commented 5 years ago

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?

saulimus commented 5 years ago

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...