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

Support SET ROLE for clickhouse.Conn #1443

Open
mshustov opened this issue Nov 29, 2024 Discussed in #1391 · 0 comments
Open

Support SET ROLE for clickhouse.Conn #1443

mshustov opened this issue Nov 29, 2024 Discussed in #1391 · 0 comments

Comments

@mshustov
Copy link
Member

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

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

No branches or pull requests

1 participant