ClickHouse / clickhouse-js

Official JS client for ClickHouse DB
https://clickhouse.com
Apache License 2.0
213 stars 26 forks source link

Add role support via query parameters #269

Open slvrtrn opened 4 months ago

slvrtrn commented 4 months ago

See

pulpdrew commented 2 weeks ago

@slvrtrn Are you actively working on this, or would it be alright if I attempted it?

slvrtrn commented 2 weeks ago

@pulpdrew, sure, please feel free to do so. I think the impl is more or less as follows: We should have

role: string | Array<string>

added to BaseClickHouseClientConfigOptions (client-common/src/config.ts)

In case of any questions, please feel free to contact me in the community Slack.

NB: in the case of just a single role now, the current workaround could be

const client = createClient({
  clickhouse_settings: {
    role: 'my_role',
  }
})

should work similarly with the other methods (query, insert, command, exec). But this will not allow to provide multiple roles.