Azuredatastudio: Multi-connection string for SQL notebooks

Created on 15 Apr 2019  路  3Comments  路  Source: microsoft/azuredatastudio

  • Azure Data Studio Version: 1,5,2

Steps to Reproduce:

Unlike programming in python for example, when using SQL there are many times when you need to open several connections to a server with different usernames due to permissions to access/alter things in different databases.

When using SQL in notebooks, it would be incredibly useful to be able to specify a set connection string for certain cells. So the notebook defaults to server1,userid1,database1 but cell 3 for example might use server1,user2,database2.

Even better if we can take a result set from that 2nd connection string, store it into a variable (like python dataframe I guess) and then access that variable through out the rest of the notebook which is still using connection string 1.

Hope that makes sense.

Area - Notebooks Enhancement Done

Most helpful comment

I can give another example:
When debugging data flows between two (or more) databases (across different servers), having queries against the source and the target database, it would be amazing to use notebooks with multiple connections. Currently it's not a feasible application of notebooks for me, although the advantages are clear: repetitive tasks like that or for documentation/knowledge sharing, notebooks would be great to use.

All 3 comments

Just to add some additional reasons this might be helpful... with Azure SQL, cross database queries aren't supported, but you can still have multiple Azure SQL databases in a single instance. It would be useful if the notebook's default connection didn't have to specify the database, but only the server and then each cell could use a different database.

I can try to clarify if needed.

Totally agree with this. There are several times I need to put together a 'narrative' in my notebook that requires connection changes, but I just have to put a bold text saying the connection changed to such-and-such db.

I attempted to create an extension that added a new type of cell you could add to a SQL kernel notebook. (IE: Add Code, Add Text, _Add Connection Change_) but couldn't get far as I do not believe it is currently possible for an extension to add that functionality, and haven't had time to dig into the full source to find out.

I can give another example:
When debugging data flows between two (or more) databases (across different servers), having queries against the source and the target database, it would be amazing to use notebooks with multiple connections. Currently it's not a feasible application of notebooks for me, although the advantages are clear: repetitive tasks like that or for documentation/knowledge sharing, notebooks would be great to use.

Was this page helpful?
0 / 5 - 0 ratings