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

Access management queries fail because of obligatory FORMAT #142

Open
ZiggerZZ opened this issue Oct 27, 2022 · 1 comment
Open

Access management queries fail because of obligatory FORMAT #142

ZiggerZZ opened this issue Oct 27, 2022 · 1 comment

Comments

@ZiggerZZ
Copy link

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?

@ZiggerZZ
Copy link
Author

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)}`;
        }

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

1 participant