Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

select format csv not work #78

Open
peaksnail opened this issue Jul 8, 2021 · 1 comment
Open

select format csv not work #78

peaksnail opened this issue Jul 8, 2021 · 1 comment

Comments

@peaksnail
Copy link

var stream = ch.query ("SELECT 1 FORMAT CSV"); // or var stream = ch.query ("SELECT 1",format: 'CSV');
stream.on ('data', function (row) {
console.log(row);
});

not work return nothing

when
var stream = ch.query ("SELECT 1 ");

it works

@api-haus
Copy link

api-haus commented Sep 28, 2021

yandex/clickhouse-server:20.3.21.2 none of these work:

stream = clickHouseCliento.query('SELECT 1', { format: 'CSV' })
// makes RecordStream with format CSV
stream.on('data',console.log).on('end',()=>console.log('end'))
// console output: end
stream = clickHouseCliento.query('SELECT 1 FORMAT CSV', {})
// makes RecordStream with format JSONCompact
stream.on('data',console.log).on('end',()=>console.log('end'))
// console output: end
stream = clickHouseCliento.query('SELECT 1 FORMAT CSV', {omitFormat:true})
// makes RecordStream with format JSONCompact
stream.on('data',console.log).on('end',()=>console.log('end'))
// console output: end
stream = clickHouseCliento.query('SELECT 1 FORMAT CSV', {omitFormat:true,readonly:true})
// makes RecordStream with format JSONCompact
stream.on('data',console.log).on('end',()=>console.log('end'))
// console output: end

Only JSON streams are working:

clickHouseCliento.query('SELECT 1').on('data',console.log).on('end',()=>console.log('end'))
// [ 1 ]\n end

CURL confirms the sanity:

$ echo 'SELECT 1 FORMAT CSVWithNames' | curl 'http://localhost:8123/' --data-binary @-
"1"
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants