Skip to content

Commit f6eafb7

Browse files
authored
Merge pull request #202621 from markingmyname/pgat
[PostgreSQL] Removed applies to includes from within code blocks
2 parents 1efca88 + 2472c27 commit f6eafb7

File tree

5 files changed

+24
-36
lines changed

5 files changed

+24
-36
lines changed

articles/mysql/single-server/how-to-auto-grow-storage-powershell.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ms.author: pariks
99
ms.custom: devx-track-azurepowershell
1010
ms.date: 06/20/2022
1111
---
12+
1213
# Auto grow storage in Azure Database for MySQL server using PowerShell
1314

1415
[!INCLUDE[applies-to-mysql-single-server](../includes/applies-to-mysql-single-server.md)]

articles/mysql/single-server/quickstart-create-mysql-server-database-using-azure-portal.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ title: 'Quickstart: Create a server - Azure portal - Azure Database for MySQL'
33
description: This article walks you through using the Azure portal to create a sample Azure Database for MySQL server in about five minutes.
44
ms.service: mysql
55
ms.subservice: single-server
6+
ms.topic: quickstart
67
author: savjani
78
ms.author: pariks
89
ms.custom: mvc, mode-ui
9-
ms.topic: quickstart
1010
ms.date: 06/20/2022
1111
---
1212

articles/postgresql/flexible-server/connect-csharp.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ ms.date: 11/30/2021
1414

1515
# Quickstart: Use .NET (C#) to connect and query data in Azure Database for PostgreSQL - Flexible Server
1616

17-
[!INCLUDE [!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
17+
[!INCLUDE [applies-to-postgresql-flexible-server](../includes/applies-to-postgresql-flexible-server.md)]
1818

1919
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL using a C# application. It shows how to use SQL statements to query, insert, update, and delete data in the database. The steps in this article assume that you are familiar with developing using C#, and that you are new to working with Azure Database for PostgreSQL.
2020

2121
## Prerequisites
22+
2223
For this quickstart you need:
2324

2425
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
@@ -29,6 +30,7 @@ For this quickstart you need:
2930
- Install [Npgsql](https://www.nuget.org/packages/Npgsql/) NuGet package in Visual Studio.
3031

3132
## Get connection information
33+
3234
Get the connection information needed to connect to the Azure Database for PostgreSQL. You need the fully qualified server name and login credentials.
3335

3436
1. Log in to the [Azure portal](https://portal.azure.com/).
@@ -38,6 +40,7 @@ Get the connection information needed to connect to the Azure Database for Postg
3840
:::image type="content" source="./media/connect-csharp/1-connection-string.png" alt-text="Azure Database for PostgreSQL server name":::
3941

4042
## Step 1: Connect and insert data
43+
4144
Use the following code to connect and load the data using **CREATE TABLE** and **INSERT INTO** SQL statements. The code uses NpgsqlCommand class with method:
4245
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database.
4346
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) sets the CommandText property.
@@ -119,6 +122,7 @@ namespace Driver
119122
[Having any issues? Let us know.](https://github.com/MicrosoftDocs/azure-docs/issues)
120123

121124
## Step 2: Read data
125+
122126
Use the following code to connect and read the data using a **SELECT** SQL statement. The code uses NpgsqlCommand class with method:
123127
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to PostgreSQL.
124128
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) and [ExecuteReader()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteReader) to run the database commands.
@@ -193,6 +197,7 @@ namespace Driver
193197

194198

195199
## Step 3: Update data
200+
196201
Use the following code to connect and update the data using an **UPDATE** SQL statement. The code uses NpgsqlCommand class with method:
197202
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to PostgreSQL.
198203
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand), sets the CommandText property.
@@ -257,6 +262,7 @@ namespace Driver
257262
[Having any issues? Let us know.](https://github.com/MicrosoftDocs/azure-docs/issues)
258263

259264
## Step 4: Delete data
265+
260266
Use the following code to connect and delete data using a **DELETE** SQL statement.
261267

262268
The code uses NpgsqlCommand class with method [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database. Then, the code uses the [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) method, sets the CommandText property, and calls the method [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) to run the database commands.
@@ -326,6 +332,7 @@ az group delete \
326332
```
327333

328334
## Next steps
335+
329336
> [!div class="nextstepaction"]
330337
> [Manage Azure Database for MySQL server using Portal](./how-to-manage-server-portal.md)<br/>
331338

articles/postgresql/single-server/connect-csharp.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ ms.date: 10/18/2020
1919
This quickstart demonstrates how to connect to an Azure Database for PostgreSQL using a C# application. It shows how to use SQL statements to query, insert, update, and delete data in the database. The steps in this article assume that you are familiar with developing using C#, and that you are new to working with Azure Database for PostgreSQL.
2020

2121
## Prerequisites
22+
2223
For this quickstart you need:
2324

2425
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
@@ -36,6 +37,7 @@ For this quickstart you need:
3637
- Install [Npgsql](https://www.nuget.org/packages/Npgsql/) NuGet package in Visual Studio.
3738

3839
## Get connection information
40+
3941
Get the connection information needed to connect to the Azure Database for PostgreSQL. You need the fully qualified server name and login credentials.
4042

4143
1. Log in to the [Azure portal](https://portal.azure.com/).
@@ -45,6 +47,7 @@ Get the connection information needed to connect to the Azure Database for Postg
4547
:::image type="content" source="./media/connect-csharp/1-connection-string.png" alt-text="Azure Database for PostgreSQL server name":::
4648

4749
## Step 1: Connect and insert data
50+
4851
Use the following code to connect and load the data using **CREATE TABLE** and **INSERT INTO** SQL statements. The code uses NpgsqlCommand class with method:
4952
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database.
5053
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) sets the CommandText property.
@@ -124,6 +127,7 @@ namespace Driver
124127
```
125128

126129
## Step 2: Read data
130+
127131
Use the following code to connect and read the data using a **SELECT** SQL statement. The code uses NpgsqlCommand class with method:
128132
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to PostgreSQL.
129133
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) and [ExecuteReader()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteReader) to run the database commands.
@@ -196,6 +200,7 @@ namespace Driver
196200
```
197201

198202
## Step 3: Update data
203+
199204
Use the following code to connect and update the data using an **UPDATE** SQL statement. The code uses NpgsqlCommand class with method:
200205
- [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to PostgreSQL.
201206
- [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand), sets the CommandText property.
@@ -258,6 +263,7 @@ namespace Driver
258263
```
259264

260265
## Step 4: Delete data
266+
261267
Use the following code to connect and delete data using a **DELETE** SQL statement.
262268

263269
The code uses NpgsqlCommand class with method [Open()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_Open) to establish a connection to the PostgreSQL database. Then, the code uses the [CreateCommand()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlConnection.html#Npgsql_NpgsqlConnection_CreateCommand) method, sets the CommandText property, and calls the method [ExecuteNonQuery()](https://www.npgsql.org/doc/api/Npgsql.NpgsqlCommand.html#Npgsql_NpgsqlCommand_ExecuteNonQuery) to run the database commands.
@@ -327,6 +333,7 @@ az group delete \
327333
```
328334

329335
## Next steps
336+
330337
> [!div class="nextstepaction"]
331338
> [Manage Azure Database for MySQL server using Portal](./how-to-create-manage-server-portal.md)<br/>
332339

articles/postgresql/single-server/connect-python.md

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ In this quickstart, you will learn how to connect to the database on Azure Datab
2323
2424

2525
## Prerequisites
26+
2627
For this quickstart you need:
2728

2829
- An Azure account with an active subscription. [Create an account for free](https://azure.microsoft.com/free).
@@ -41,6 +42,7 @@ For this quickstart you need:
4142
- Install [psycopg2](https://pypi.python.org/pypi/psycopg2-binary/) using `pip install psycopg2-binary` in a terminal or command prompt window. For more information, see [how to install `psycopg2`](https://www.psycopg.org/docs/install.html).
4243

4344
## Get database connection information
45+
4446
Connecting to an Azure Database for PostgreSQL database requires the fully qualified server name and login credentials. You can get this information from the Azure portal.
4547

4648
1. In the [Azure portal](https://portal.azure.com/), search for and select your Azure Database for PostgreSQL server name.
@@ -57,6 +59,7 @@ Connecting to an Azure Database for PostgreSQL database requires the fully quali
5759
> - `<database-name>` a default database named *postgres* was automatically created when you created your server. You can rename that database or [create a new database](https://www.postgresql.org/docs/current/sql-createdatabase.html) by using SQL commands.
5860
5961
## Step 1: Connect and insert data
62+
6063
The following code example connects to your Azure Database for PostgreSQL database using
6164
- [psycopg2.connect](https://www.psycopg.org/docs/connection.html) function, and loads data with a SQL **INSERT** statement.
6265
- [cursor.execute](https://www.psycopg.org/docs/cursor.html#execute) function executes the SQL query against the database.
@@ -66,9 +69,6 @@ import psycopg2
6669

6770
# Update connection string information
6871

69-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
70-
71-
7272
host = "<server-name>"
7373
dbname = "<database-name>"
7474
user = "<admin-username>"
@@ -77,9 +77,6 @@ sslmode = "require"
7777

7878
# Construct connection string
7979

80-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
81-
82-
8380
conn_string = "host={0} user={1} dbname={2} password={3} sslmode={4}".format(host, user, dbname, password, sslmode)
8481
conn = psycopg2.connect(conn_string)
8582
print("Connection established")
@@ -88,35 +85,23 @@ cursor = conn.cursor()
8885

8986
# Drop previous table of same name if one exists
9087

91-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
92-
93-
9488
cursor.execute("DROP TABLE IF EXISTS inventory;")
9589
print("Finished dropping table (if existed)")
9690

9791
# Create a table
9892

99-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
100-
101-
10293
cursor.execute("CREATE TABLE inventory (id serial PRIMARY KEY, name VARCHAR(50), quantity INTEGER);")
10394
print("Finished creating table")
10495

10596
# Insert some data into the table
10697

107-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
108-
109-
11098
cursor.execute("INSERT INTO inventory (name, quantity) VALUES (%s, %s);", ("banana", 150))
11199
cursor.execute("INSERT INTO inventory (name, quantity) VALUES (%s, %s);", ("orange", 154))
112100
cursor.execute("INSERT INTO inventory (name, quantity) VALUES (%s, %s);", ("apple", 100))
113101
print("Inserted 3 rows of data")
114102

115103
# Clean up
116104

117-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
118-
119-
120105
conn.commit()
121106
cursor.close()
122107
conn.close()
@@ -128,6 +113,7 @@ When the code runs successfully, it produces the following output:
128113

129114

130115
## Step 2: Read data
116+
131117
The following code example connects to your Azure Database for PostgreSQL database and uses
132118
- [cursor.execute](https://www.psycopg.org/docs/cursor.html#execute) with the SQL **SELECT** statement to read data.
133119
- [cursor.fetchall()](https://www.psycopg.org/docs/cursor.html#cursor.fetchall) accepts a query and returns a result set to iterate over by using
@@ -136,51 +122,37 @@ The following code example connects to your Azure Database for PostgreSQL databa
136122

137123
# Fetch all rows from table
138124

139-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
140-
141-
142125
cursor.execute("SELECT * FROM inventory;")
143126
rows = cursor.fetchall()
144127

145128
# Print all rows
146129

147-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
148-
149-
150130
for row in rows:
151131
print("Data row = (%s, %s, %s)" %(str(row[0]), str(row[1]), str(row[2])))
152-
153-
154132
```
155133

156134
## Step 3: Update data
135+
157136
The following code example uses [cursor.execute](https://www.psycopg.org/docs/cursor.html#execute) with the SQL **UPDATE** statement to update data.
158137

159138
```Python
160139

161140
# Update a data row in the table
162141

163-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
164-
165-
166142
cursor.execute("UPDATE inventory SET quantity = %s WHERE name = %s;", (200, "banana"))
167143
print("Updated 1 row of data")
168-
169144
```
170145

171146
## Step 5: Delete data
147+
172148
The following code example runs [cursor.execute](https://www.psycopg.org/docs/cursor.html#execute) with the SQL **DELETE** statement to delete an inventory item that you previously inserted.
173149

174150
```Python
175151

176152
# Delete data row from table
177153

178-
[!INCLUDE [applies-to-postgresql-single-server](../includes/applies-to-postgresql-single-server.md)]
179-
180-
181154
cursor.execute("DELETE FROM inventory WHERE name = %s;", ("orange",))
182155
print("Deleted 1 row of data")
183-
184156
```
185157

186158
## Clean up resources
@@ -194,6 +166,7 @@ az group delete \
194166
```
195167

196168
## Next steps
169+
197170
> [!div class="nextstepaction"]
198171
> [Manage Azure Database for MySQL server using Portal](./how-to-create-manage-server-portal.md)<br/>
199172

0 commit comments

Comments
 (0)