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: articles/postgresql/flexible-server/connect-python.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ This article assumes that you're familiar with developing using Python, but you'
31
31
- If you created your flexible server with *Public access (allowed IP addresses)*, you can add your local IP address to the list of firewall rules on your server. Refer to [Create and manage Azure Database for PostgreSQL - Flexible Server firewall rules using the Azure CLI](./how-to-manage-firewall-cli.md).
32
32
33
33
## Install the Python libraries for PostgreSQL
34
-
The [psycopg2](https://pypi.python.org/pypi/psycopg2/) module enables connecting to and querying a PostgreSQL database, and is available as a Linux, macOS, or Windows [wheel](https://pythonwheels.com/) package. Install the binary version of the module, including all the dependencies. For more information about `psycopg2` installation and requirements, see [Installation](http://initd.org/psycopg/docs/install.html).
34
+
The [psycopg2](https://pypi.python.org/pypi/psycopg2/) module enables connecting to and querying a PostgreSQL database, and is available as a Linux, macOS, or Windows [wheel](https://pythonwheels.com/) package. Install the binary version of the module, including all the dependencies.
35
35
36
36
To install `psycopg2`, open a terminal or command prompt and run the command `pip install psycopg2`.
37
37
@@ -61,7 +61,7 @@ For each code example in this article:
61
61
1. To run the file, change to your project folder in a command-line interface, and type `python` followed by the filename, for example `python postgres-insert.py`.
62
62
63
63
## Create a table and insert data
64
-
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database using the [psycopg2.connect](http://initd.org/psycopg/docs/connection.html) function, and loads data with a SQL **INSERT** statement. The [cursor.execute](http://initd.org/psycopg/docs/cursor.html#execute) function executes the SQL query against the database.
64
+
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database using the psycopg2.connect function, and loads data with a SQL **INSERT** statement. The cursor.execute function executes the SQL query against the database.
65
65
66
66
```Python
67
67
import psycopg2
@@ -110,7 +110,7 @@ When the code runs successfully, it produces the following output:
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses [cursor.execute](http://initd.org/psycopg/docs/cursor.html#execute) with the SQL **SELECT** statement to read data. This function accepts a query and returns a result set to iterate over by using [cursor.fetchall()](http://initd.org/psycopg/docs/cursor.html#cursor.fetchall).
113
+
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses cursor.execute with the SQL**SELECT** statement to read data. This function accepts a query and returns a result set to iterate over by using cursor.fetchall()
114
114
115
115
```Python
116
116
import psycopg2
@@ -148,7 +148,7 @@ conn.close()
148
148
```
149
149
150
150
## Update data
151
-
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses [cursor.execute](http://initd.org/psycopg/docs/cursor.html#execute) with the SQL **UPDATE** statement to update data.
151
+
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses cursor.execute with the SQL**UPDATE** statement to update data.
152
152
153
153
```Python
154
154
import psycopg2
@@ -181,7 +181,7 @@ conn.close()
181
181
```
182
182
183
183
## Delete data
184
-
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses [cursor.execute](http://initd.org/psycopg/docs/cursor.html#execute) with the SQL **DELETE** statement to delete an inventory item that you previously inserted.
184
+
The following code example connects to your Azure Database for PostgreSQL - Flexible Server database and uses cursor.execute with the SQL**DELETE** statement to delete an inventory item that you previously inserted.
0 commit comments