clickhouse
clickhouse copied to clipboard
Access management queries fail because of obligatory FORMAT
await client.query("CREATE USER hello HOST ANY IDENTIFIED WITH sha256_password BY 'world').toPromise();
fails with ERROR [ExceptionsHandler] Syntax error: failed at position 77 ('FORMAT'): FORMAT JSON;
The library automatically ends a format (json/csv/tsv) and it makes sense for SELECT queries, however it fails for access management queries.
Any idea for a workaround?
For those who need this as well: I ended up copying index.js
to my project and replacing lines 523-525 by
if (query.toUpperCase().startsWith('CREATE USER') ||
query.toUpperCase().startsWith('GRANT SELECT') ||
query.toUpperCase().startsWith('CREATE ROW POLICY')) {
}
else if ( ! R_FORMAT_PARSER.test(query)) {
query += ` FORMAT ${ClickHouse.getFullFormatName(me.format)}`;
}