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

Multiple Connections #69

Closed
UncleVic opened this issue Mar 2, 2018 · 11 comments

Comments

Projects
None yet
4 participants
@UncleVic
Copy link

commented Mar 2, 2018

This is a guideline to help us to understand SQLTools Issues.

You don't need to stick to this, but please try to guide us to reproduce the errors or understand your feature requests.

Issue Type

  • Feature Request
  • Bugfix/Errors
  • Questions
  • Other

Prerequisites (For bugfixes)

  • Are you running the latest version?
  • Did you check the logs?
  • Did you check the Setup?

Description

I've connected to more than 1 DB but see just first DB at sidebar

Steps to Reproduce (For bugfixes)

  1. Connect to first DB
  2. Connect to second DB
  3. [and so on...]

Expected behavior: [What you expected to happen]
Added 2 connections to sidebar

Actual behavior: [What actually happened]
Just first connection

Versions

  • Version: v0.12.1
  • OS: osx
  • SGDB: MSSQL

You can get this information from executing SQLTools: Version from VSCode Quick Open.

@mtxr

This comment has been minimized.

Copy link
Owner

commented Mar 2, 2018

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 :(

@mtxr mtxr self-assigned this Jun 6, 2018

@mtxr mtxr modified the milestones: v0.15.1, v0.16.0 Sep 23, 2018

@mtxr mtxr changed the title Refresh sidebar Multiple Connections Sep 23, 2018

@autolabeler-mtxr autolabeler-mtxr bot added the bug label Sep 23, 2018

@mtxr mtxr referenced this issue Jan 11, 2019

Closed

NEXT RELEASE: Webpacked Extension #115

7 of 7 tasks complete

@mtxr mtxr closed this in 477dfe0 Jan 20, 2019

@PapsOu

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

@mtxr Have you intentionally removed the button that opens a new empty SQL editor ?
20190121-160054
I'm under fedora 29 and I don't see any problems for the moment.
Queries are executed quicker than previous version.
Nice job !

@mtxr

This comment has been minimized.

Copy link
Owner

commented Jan 21, 2019

@PapsOu

This comment has been minimized.

Copy link
Contributor

commented Jan 21, 2019

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 something.sql file into my projects that will holds my usefull queries (and ignoring it form SCM).

I think this button was very useful for any user that do this process :

  1. Create a connection for a specific DB.
  2. Connect to the database.
  3. List tables and, optionally, their columns.
  4. Query content of specific table (with the list button)
  5. Apply a particular query to apply a larger limit or any where conditions.

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.

@mtxr mtxr removed this from the v0.17.x - next milestone Feb 11, 2019

@ransagy

This comment has been minimized.

Copy link

commented Apr 14, 2019

Just to be sure; This is closed, But i can't currently see an option to have multiple connections open, Only one. I.e. each sql file tab has its own connection, so i can work in multiple DBs at once.
Does this issue refer just to the UI? if so, i'll open a new issue.

@mtxr

This comment has been minimized.

Copy link
Owner

commented Apr 14, 2019

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 -- @connection <name> to set a connection per file.

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.
But I really like the idea. That's something that already exists in other tools like Datagrip, dbeaver etc..

What do you think of this temporary solution?

@mtxr mtxr reopened this Apr 14, 2019

@mtxr

This comment has been minimized.

Copy link
Owner

commented Apr 14, 2019

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.

@mtxr mtxr closed this Apr 14, 2019

@ransagy

This comment has been minimized.

Copy link

commented Apr 15, 2019

First thing: the @conn block seems to take only the first word of text, so if i have a connection named DEV MAIN DB it will try to run it on a connection named DEV.

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!

@mtxr

This comment has been minimized.

Copy link
Owner

commented Apr 16, 2019

@ransagy thanks. In fact the regex is matching only [\w_]. I've fixed it.

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.

https://github.com/mtxr/vscode-sqltools/blob/5e3644e8ef7f78673539c20941b26f7d8a51f93d/static/session-file-example.gif?raw=true

I believe I'm on the right path, what do you think?

@mtxr mtxr reopened this Apr 16, 2019

@ransagy

This comment has been minimized.

Copy link

commented Apr 16, 2019

@mtxr That looks great! Looking forward to it.

@mtxr

This comment has been minimized.

Copy link
Owner

commented May 16, 2019

@ransagy I finally got it working. We can open a session file when connecting, we can also attach and detach a connection from the file.

The PR #188 is pending docs to be released.

@mtxr mtxr closed this in #188 May 18, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.