cube-js / cube

📊 Cube — The Semantic Layer for Building Data Applications
https://cube.dev
Other
17.85k stars 1.77k forks source link

Postgres connection - add option to set user "role" #8530

Open Kartikeya-Tiwari opened 2 months ago

Kartikeya-Tiwari commented 2 months ago

Is your feature request related to a problem? Please describe. I am trying to connect my Postgres instance to Cube Core - however our instance is set in a way where in addition to providing Username and Password we also need to provide a user role (https://www.postgresql.org/docs/current/sql-set-role.html)

Based on my research seems like Cube currently does not support this.

It would be great if we could support this as an optional configuration option just like dbt (https://docs.getdbt.com/docs/core/connect-data-platform/postgres-setup)

Describe the solution you'd like It would be great if we could have an environment variable to set user role, just like the ones we have for username and password. Also, @igorlukanin suggested another option on slack that - we could achieve this via "initSql" config option, just like for it is done in DuckDB https://github.com/cube-js/cube/blob/34d319a8d81744bde1e655fefeb23496f2fe1089/packages/cubejs-duckdb-driver/src/DuckDBDriver.ts#L163-L173

Thanks

github-actions[bot] commented 2 months ago

If you are interested in working on this issue, please go ahead and provide PR for that. We'd be happy to review it and merge it. If this is the first time you are contributing a Pull Request to Cube, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube Slack.

igorlukanin commented 2 months ago

Also, @igorlukanin suggested another option on slack that - we could achieve this via "initSql" config option, just like for it is done in DuckDB

I actually believe it would be great to have initSql for any data source driver! I wonder if anyone is open to contributing this 😄