dbeaver / dbeaver

Free universal database tool and SQL client
https://dbeaver.io
Apache License 2.0
40.2k stars 3.47k forks source link

Set bootstrap queries via the dbeaver-cli? #35747

Open jcrben opened 3 weeks ago

jcrben commented 3 weeks ago

Is your feature request related to a problem? Please describe.

We can create a connection via a script with various parameters defined at https://github.com/dbeaver/dbeaver/wiki/Command-Line#connection-parameters - is it possible to add a bootstrap query to this? This is particularly helpful for something like sqlite which needs PRAGMA foreign_keys = ON; to enforce foreign key constraints.

Describe the solution you'd like See description

Describe alternatives you've considered Manual setup

Additional context I'm currently setting up my sqlite connection with something like this: dbeaver-cli -con 'driver=sqlite|url=jdbc:sqlite:c:\Users\ben\mytestdb.db|database=C:\Users\ben\mytestdb.db|name=myconnection1|save=true|create=true

E1izabeth commented 3 weeks ago

Currently, it's not possible. Thank you for your request. We only have Shell commands before/after connect/disconnect (in Connection settings -> Shell commands), but they can't be set from the cli.

jcrben commented 3 weeks ago

You also have the option to set bootstrap queries via the gui and setting the pragma there worked

E1izabeth commented 3 weeks ago

Yes, you're right