By now, you’ve probably heard of Azure Data Studio, the lightweight, cross-platform tool for data professionals to connect to, query, and otherwise explore data sources for all sorts of databases, and not just Microsoft SQL Server (see below). I love it, and I’m happy to see people using it either where I work or out in the wild.
Still, I get feedback from people all the time that they don’t think it’s a good replacement for SQL Server Management Studio (SSMS). Without starting an argument, I don’t think of it as a replacement; I view it as a side-by-side tool with a stronger focus on development than something like SSMS where I can do more administrative work. But that doesn’t stop people from pooh-poohing it, complaining about things it can’t do compared to what they’re familiar with.
So let’s say we’ve got ourselves a good ol’ comma separated file. Maybe it even looks like this:
First things first, we’re going to go and grab the latest “SQL Server Import’ extension from the extension marketplace. We’ll go ahead and click on the “extensions” tab on the left hand side, and we’ll just search the marketplace for “import.” Here’s what I’m seeing:
(Side note: as of the time of this writing, there aren’t many extensions in the marketplace for Azure Data Studio, but it’s growing rapidly. Your search might be a little trickier, or, the name of this extension might change. I’d recommend sticking with the Microsoft-supplied one, but hey, there might be something better, and if you found one, tell me!)
If your extension installed successfully, you should now have a new context menu when you right-click on your database name in Azure Data Studio:
So let’s follow-through. After we click this option, we’re going to get a wizard to walk us through the import. Most of this is pretty self-explanatory, but here we go. One thing to note: you *have* to import your data into a new table. I have no clue as to why, but that’s just how it works (for now?):
If you did it right, you’ll get a preview of your data file on the next step. Hi, Erik!
With that done, you now move on to the tedium: specifying your import schema. This is by far the hardest part of this process. Granted, our file is small and we don’t have a lot of fields, but imagine how this would look if you had more. On top of that, the wizard sometimes doesn’t make the best decisions about your data types, either. For instance, in my source data I had the word “Yes” in a column and this wizard wants to translate this to a bit field. Maybe you want that, maybe you don’t. So take your time and know what you’re picking.
Once you’re satisfied, click import data! If everything worked, you’ll get a happy checkmark. If not, you just get a generic error. Why did it fail? Who knows! Maybe your table already exists, maybe you have a data type conflict somewhere. The extension isn’t really fully functional here, but I’m hoping it improves.
Once it’s done, you’re off to the races. You can start querying your new table just like you would anything else in Azure Data Studio. Since we had to drop this data into a new table, we could easily do some work to get this data where you really wanted it.
Even though this blog post set out to talk about how it’s entirely possible to import your data with Azure Data Studio, there’s a bigger theme at play here: thanks to the solid foundations Microsoft built upon, there’s an ever evolving landscape of capabilities that you can add on to the core concept of Azure Data Studio. If you dismissed this product early on, you owe it to yourself to take another look and continue to experiment with it. Also sharp-eyed readers might have noticed that these screen shots were taken on my Mac; I love the cross-platform portability this product gives me, and for every day SQL development, it’s great.
And finally, I’ll be the first to say it could be better in some places. But guess what? Microsoft listens, so go open some issues on their Github project page. After all, it’s through feedback that this tool continues to get better. All of this wouldn’t be possible with the constant effort of the SQL Tools Team. They rock, and they deserve a ton of thanks!