Using Python MSSQL-CLI in SQL Server
Hello to everyone,
In this article, I will try to give information about using Python MSSQL-CLI in SQL Server.
First, let me talk about what MSSQL-CLI is.
MSSQL-CLI is an interactive command line query tool for SQL Server. It is open source and built with Python. It can be used easily on MSDOS. It has autocomplete feature on MSDOS.
You don’t need to know Python to do the operations. It is important that you download and install the 3.10.
If you have done the Python installation, it’s time to install MSSQL-CLI.
Let’s go to the site below.
Copy the part in the red area, paste it into MSDOS and press ENTER. You will see a process similar to the one below.
The yellow warning is a warning that our Pip version is out of date. If you wish, you can update our version of Pip as indicated by the warning.
The installation process is complete. Now it’s time to use it.
mssql-cli -S YAVUZSELIM\YAVUZSELIM -d Northwind -U sa -P WriteyourownPassword
Press ENTER after typing the command. You will see the result below.
YAVUZSELIM\YAVUZSELIM is my SQL Server login INSTANCE NAME name. Northwind database name. sa user login name. Finally, you will revise your sa password above according to yourself.
Now let’s write our query.
I typed the query and pressed ENTER. If the result is too much, you can see the rest by pressing the SPACE button. I also added a gif image related to its usage below. You can review.
As you can see, we have successfully run our query using Python MSSQL-CLI.
Good luck to everyone in business and life.