You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/connect/python/mssql-python/python-sql-driver-mssql-python-quickstart.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: This quickstart describes installing Python, and mssql-python then
4
4
author: dlevy-msft-sql
5
5
ms.author: dlevy
6
6
ms.reviewer: vanto, randolphwest
7
-
ms.date: 07/09/2025
7
+
ms.date: 07/10/2025
8
8
ms.service: sql
9
9
ms.subservice: connectivity
10
10
ms.topic: quickstart-sdk
@@ -56,6 +56,7 @@ Get the [`mssql-python` package](https://pypi.org/project/mssql-python/) from Py
56
56
### [Linux](#tab/linux)
57
57
58
58
```bash
59
+
sudo apt-get -y install libltdl7
59
60
pip install mssql-python
60
61
```
61
62
@@ -139,9 +140,9 @@ This quickstart requires the *[!INCLUDE [sssampledbnormal-md](../../../includes/
139
140
conn = connect(getenv("SQL_CONNECTION_STRING"))
140
141
```
141
142
142
-
1. In the current directory, create a new file named `*.env`.
143
+
1. In the current directory, create a new file named `.env`.
143
144
144
-
1. Within the `*.env` file, add an entry for your connection string named `SQL_CONNECTION_STRING`. Replace the example here with your actual connection string value.
145
+
1. Within the `.env` file, add an entry for your connection string named `SQL_CONNECTION_STRING`. Replace the example here with your actual connection string value.
Copy file name to clipboardExpand all lines: docs/connect/python/pymssql/python-sql-driver-pymssql-quickstart.md
+17-7Lines changed: 17 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: This quickstart describes installing Python, and pymssql then shows
4
4
author: dlevy-msft-sql
5
5
ms.author: dlevy
6
6
ms.reviewer: vanto, randolphwest
7
-
ms.date: 06/18/2025
7
+
ms.date: 07/10/2025
8
8
ms.service: sql
9
9
ms.subservice: connectivity
10
10
ms.topic: quickstart-sdk
@@ -14,7 +14,7 @@ ms.custom:
14
14
15
15
# Quickstart: Connect with the pymssql driver for Python
16
16
17
-
In this quickstart, you connect a Python script to a database that you have created and loaded with sample data. You use the `pymssql` driver for Python to connect to your database and perform basic operations, like reading and writing data.
17
+
In this quickstart, you connect a Python script to a database that you created and loaded with sample data. You use the `pymssql` driver for Python to connect to your database and perform basic operations, like reading and writing data.
@@ -37,7 +37,7 @@ In this quickstart, you connect a Python script to a database that you have crea
37
37
Follow these steps to configure your development environment to develop an application using the `pymssql` Python driver.
38
38
39
39
> [!NOTE]
40
-
> This driver uses the [TDS](/openspecs/windows_protocols/ms-tds/b46a581a-39de-4745-b076-ec4dbb7d13ec) protocol, which is enabled by default in SQL Server, SQL database in Fabric and Azure SQL Database. No extra configuration is required.
40
+
> This driver uses the [Tabular Data Stream (TDS)](/openspecs/windows_protocols/ms-tds/b46a581a-39de-4745-b076-ec4dbb7d13ec) protocol, which is enabled by default in SQL Server, SQL database in Fabric and Azure SQL Database. No extra configuration is required.
41
41
42
42
### Install the pymssql package
43
43
@@ -51,6 +51,16 @@ Get the [`pymssql` package](https://pypi.org/project/pymssql/) from PyPI.
51
51
pip install pymssql
52
52
```
53
53
54
+
### Install python-dotenv package
55
+
56
+
Get the [`python-dotenv`](https://pypi.org/project/python-dotenv/) from PyPI.
57
+
58
+
1. In the same directory, install the `python-dotenv` package.
59
+
60
+
```bash
61
+
pip install python-dotenv
62
+
```
63
+
54
64
### Check installed packages
55
65
56
66
You can use the PyPI command-line tool to verify that your intended packages are installed.
@@ -112,9 +122,9 @@ This quickstart requires the *[!INCLUDE [sssampledbnormal-md](../../../includes/
1. In the current directory, create a new file named `*.env`.
125
+
1. In the current directory, create a new file named `.env`.
116
126
117
-
1. Within the `*.env` file, add entries for your connection string values named `SQL_SERVER`, `SQL_USER`, `SQL_PASSWORD`, `SQL_DATABASE`. Replace the placeholders here with your actual connection string values.
127
+
1. Within the `.env` file, add entries for your connection string values named `SQL_SERVER`, `SQL_USER`, `SQL_PASSWORD`, `SQL_DATABASE`. Replace the placeholders here with your actual connection string values.
118
128
119
129
```text
120
130
SQL_SERVER="<server_name>"
@@ -124,7 +134,7 @@ This quickstart requires the *[!INCLUDE [sssampledbnormal-md](../../../includes/
124
134
```
125
135
126
136
> [!TIP]
127
-
> The connection string used here largely depends on the type of SQL database you're connecting to. For more information on connection strings and their syntax, see [connection string syntax reference](../../ado-net/connection-string-syntax.md).
137
+
> The connection string used here largely depends on the type of SQL database you're connecting to. For more information on connection strings and their syntax, see [FreeTDS connection attributes](https://www.freetds.org/userguide/OdbcConnAttr.html).
128
138
129
139
### Execute a query
130
140
@@ -241,7 +251,7 @@ Execute an [INSERT](../../../t-sql/statements/insert-transact-sql.md) statement
241
251
```
242
252
243
253
> [!TIP]
244
-
> Optionally, you can use [`connection.rollback`](https://pymssql.readthedocs.io/en/latest/ref/pymssql.html#pymssql.Connection.rollback) to rollback the transaction.
254
+
> Optionally, you can use [`connection.rollback`](https://pymssql.readthedocs.io/en/latest/ref/pymssql.html#pymssql.Connection.rollback) to roll back the transaction.
245
255
246
256
1. Close the cursor and connection using [`cursor.close`](https://pymssql.readthedocs.io/en/latest/ref/pymssql.html#pymssql.Cursor.close) and [`connection.close`](https://pymssql.readthedocs.io/en/latest/ref/pymssql.html#pymssql.Connection.close).
Copy file name to clipboardExpand all lines: docs/connect/python/pyodbc/python-sql-driver-pyodbc-quickstart.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: This quickstart describes installing Python, and pyodbc then shows
4
4
author: dlevy-msft-sql
5
5
ms.author: dlevy
6
6
ms.reviewer: vanto, randolphwest
7
-
ms.date: 07/09/2025
7
+
ms.date: 07/10/2025
8
8
ms.service: sql
9
9
ms.subservice: connectivity
10
10
ms.topic: quickstart-sdk
@@ -126,9 +126,9 @@ Copy the `ODBC` connection string from the *Settings* tab.
126
126
conn = connect(getenv("SQL_CONNECTION_STRING"))
127
127
```
128
128
129
-
1. In the current directory, create a new file named `*.env`.
129
+
1. In the current directory, create a new file named `.env`.
130
130
131
-
1. Within the `*.env` file, add an entry for your connection string named `SQL_CONNECTION_STRING`. Replace the example here with your actual connection string value.
131
+
1. Within the `.env` file, add an entry for your connection string named `SQL_CONNECTION_STRING`. Replace the example here with your actual connection string value.
132
132
133
133
```text
134
134
SQL_CONNECTION_STRING="Driver={ODBC Driver 18 for SQL Server};Server=<server_name>;Database={<database_name>};Encrypt=yes;TrustServerCertificate=no;Authentication=ActiveDirectoryInteractive"
0 commit comments