Multiple Connections #69
Prerequisites (For bugfixes)
I've connected to more than 1 DB but see just first DB at sidebar
Steps to Reproduce (For bugfixes)
Expected behavior: [What you expected to happen]
Actual behavior: [What actually happened]
You can get this information from executing
I've been thinking about that. But there are some concerns.
When we invoke to run a query, we should decide which connection we want to run? We should run in the last used? Should we have a tab per connection to run queries on each connection?
I'm open to suggestions, because I'ld love to use multiple connections easily. But I don't see how to decide it right now :(
referenced this issue
Sep 23, 2018
Yes, in a near future we will open an SQL file for a connection. Something like pgadmin does (query tool). You can still create an empty SQL file using the command palette. Also, I always thought this button was useless and I could add more important features there, like add new connection, open sqltools settings (UI, coming soon). Does it make sense?…
On Mon, Jan 21, 2019, 13:03 PapsOu ***@***.*** wrote: @mtxr <https://github.com/mtxr> Have you intentionally removed the button that opens a new empty SQL editor ? [image: 20190121-160054] <https://user-images.githubusercontent.com/5792207/51482086-c8efc480-1d95-11e9-9749-4573c03eac23.png> — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#69 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AArL6WNiidtG8E0AGYmGorAlt26CMnerks5vFda_gaJpZM4SaM35> .
I was using this button every time I wanted to execute any SQL queries (mainly for debug purpose).
But I know I can create a
I think this button was very useful for any user that do this process :
From step 4, this button was very useful for quick debug on small projects.
And for new users of your extension, it would be good to have a button that let them directly execute SQL queries instead of manually creating a file.
The « Add new connection » button is still here. I think there is a typo because the tool-tip is « Add a new server » but the new connection Ui is displayed.
About a settings shortcut button, vscode users would be familiar with the settings UI (or, the json editor), so I don't think it's a « must have » feature, and I thought we don't change settings of extensions everyday.
Ok, that's a fair question.
We currently have a way to have multiple active connections, but not this per tab connection.
I've recently added codelens run block query support, I believe we could add a @conn/@connection inside of this blocks telling which connection should we use,
Maybe better also have a first line comment like
It's a temporary solution at least. We have a similar question on #183 . And as #183 I need to re-design some core ops to allow this kind of feature.
What do you think of this temporary solution?
Take a look at https://mtxr.gitbook.io/vscode-sqltools/changelog. Try v0.17.15.
It's a temporary solution, but allows us to manage multiple connections easier than before.
If you believe that doesnt fits for this issue, we can reopen it.
I believe it does for now since we can set the connection on first line of the file like here
But I can work it a bit further later, but won't be soon since I have to change some stuff on core code.
First thing: the
To be honest, I find the whole codelens approach as a configuration method very weird. It seems overly complicated to annotate every piece of SQL. Every single editor/extension I've seen isolates such settings to the tab instance to avoid such things, As you mentioned yourself.
For example, Microsoft's vscode-mssql extension opens a result window for each tab of SQL when you run a query in it. The connection is scoped to that tab as well.
Personally, I don't see myself using it, But it great that you added the option quickly - I'm sure others will find it useful. Thanks!
@ransagy thanks. In fact the regex is matching only
I started to work on session tabs as you said, seems to be more straightforward. Like you, I always used that kind of feature on other editors/tools, but on VSCode I wasn't finding a way to do that. But now I did!
Here is a beginning of this work if you want to try https://github.com/mtxr/vscode-sqltools/pull/188/files
When switching between tabs, the connection switches as well. This way we can easily use multiple connections without selecting a connection every time.
I believe I'm on the right path, what do you think?