Skip to content

Support SET ROLE for clickhouse.Conn #1443

Open
@mshustov

Description

@mshustov

Discussed in #1391

Originally posted by jpugliesi August 29, 2024
We have a use case where we'd like to be able to dynamically set the connection ROLE prior to executing a query (and unset it after). Ex:

SET ROLE some_role;
SELECT ...

This does not seem currently possible with the native/clickhouse clickhouse.Conn, because it pools connections under the hood and does not expose an API to retrieve and use the same, stateful connection for multiple statements.

It seems like the only way to achieve this is to use the database/sql driver's BeginTx to execute multiple statements on the same connection.

Is there some way to support SET ROLE with the native/clickhouse driver? If not, are there plans to support this functionality somehow?

This relates to #772, where exposing connection pool's acquire (or hooks into connection acquire/release from the pool) would allow this

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions