-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
Hi Team,
I am not getting result of query in one go, however I am getting few records at a time.
I am using code as mentioned below:
// Example (adapt to your trino-client version and authentication method)
import {Trino, BasicAuth} from 'trino-client';
async function test()
{
const sslOption = {
rejectUnauthorized: false
}
const client = Trino.create({
server: 'https://abc-trino.env.xyz.example.com',
catalog: 'iceberg',
auth: new BasicAuth('username', 'password'),
ssl: sslOption
});
console.log('client - ', JSON.stringify(client))
const iterData = await client.query('select * from table_name')
console.log('iterData - ', JSON.stringify(iterData))
for await (const queryResult of iterData) {
// this part is getting call/executed multiple time to return the query result
console.log('Header: ', queryResult.data);
}
}
await test();
Could anyone please help me know if trino client supports something like mentioned in below example:
const stream = await client.queryStream('SELECT * FROM your_table');
stream.on('data', (row) => {
// Process each row as it comes
console.log(row);
});
stream.on('end', () => {
console.log('Query completed');
client.end();
});
stream.on('error', (error) => {
console.error('Error:', error);
client.end();
});
Thank you.
Metadata
Metadata
Assignees
Labels
No labels