dbeaver / dbeaver/dbeaver

Ability to define variables using flexible syntax

Open
#15,978 3 comments 0 reactions 1 assignee Claimed by @E1izabeth View on GitHub
xf:sql
Dominant language
Java
Stars
51.8k
Forks
4.4k
Avg merge
3d 8h
Merged PRs (30d)
188

Description

DBeaver is a great tool and I often use it copying SQL from other tools into DBeaver to process, review and to develop it further.
After that I copy it back to the other tool - in my case ETL tools.
As ETL also use variables in their individual style it is always a process of replaceing them when copying the SQL to DBeaver and then replaceing them back before copying it back to the individual tool. This is very time consuming and tidious so I would prefer an easy way by supporting all kind of variable styles.

It would be great to get DBeaver supporting all kinds of variable styles.
I could imagine a command upfront the SQL like

> SET VARIABLE "#PS_SAMPLE.DBSchema# = BASE

Which would dynamically replace the parameterized schema name in the following SQL with the the schema string BASE.

> SELECT col1, col2
> FROM #PS_SAMPLE.DBSchema#.EMPLOYEE
> WHERE col1 > #Date#

To replace #Date# as well an additional SET could be used like this:

> SET VARIABLE "#Date# = '2022-03-26'

The parameter/variable style of #variable# is just an example - it should be flexible to support this for as many other tools as possible.
Also the SET VARIABLE is just an example and could be any style and syntax. The only important thing is that the original SQL does not need to be changed.

Alternatively there could be a central configuration to specify the parameter style.

This would enable us to copy SQL to DBeaver and running it unchanged and then copying it back with no addtional changes.
This realy would improve the usability and would be a great help.

This could also solve the following feature request as well:
_Custom syntax for variable placeholders_ #12590

Thanks in advance

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.