Skip to content

Commit 8c42cfd

Browse files
StefanStefan
authored andcommitted
cli update
1 parent 6d16fa0 commit 8c42cfd

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

articles/postgresql/flexible-server/connect-azure-cli.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ If the connection failed, try these solutions:
6767
- if you've configured your server with private access in virtual networking, make sure your client machine is in the same virtual network.
6868

6969
## Run multiple queries using interactive mode
70-
You can run multiple queries using the **interactive** mode. To enable interactive mode, run the following command
70+
You can run multiple queries using the **interactive** mode. To enable interactive mode, run the following command.
7171

7272
```azurecli-interactive
7373
az postgres flexible-server connect \
@@ -85,47 +85,47 @@ az postgres flexible-server connect \
8585
You'll see the **psql** shell experience as shown below:
8686

8787
```bash
88-
Command group 'postgres flexible-server' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
89-
Password for earthyTurtle7:
90-
Server: PostgreSQL 12.5
91-
Version: 3.0.0
92-
Chat: https://gitter.im/dbcli/pgcli
88+
Password for starchylapwing9:
89+
Server: PostgreSQL 13.14
90+
Version: 4.0.1
9391
Home: http://pgcli.com
94-
postgres> create database pollsdb;
95-
CREATE DATABASE
96-
Time: 0.308s
97-
postgres> exit
98-
Goodbye!
99-
Local context is turned on. Its information is saved in working directory C:\sunitha. You can run `az local-context off` to turn it off.
100-
Your preference of are now saved to local context. To learn more, type in `az local-context --help`
92+
postgres> SELECT 1;
93+
+----------+
94+
| ?column? |
95+
|----------|
96+
| 1 |
97+
+----------+
98+
SELECT 1
99+
Time: 0.167s
100+
postgres>
101+
```
102+
103+
## Execute single queries
104+
You can run single queries against Postgres database using [az postgres flexible-server execute](/cli/azure/postgres/flexible-server?view=azure-cli-latest#az-postgres-flexible-server-execute).
105+
106+
```azurecli-interactive
107+
az postgres flexible-server execute \
108+
-n <servername> -u <username> -p "<password>" -d <databasename> \
109+
-q <querytext> --output table
101110
```
102111

103112
**Example:**
104113
```azurecli-interactive
105114
az postgres flexible-server execute \
106115
-n postgresdemoserver -u dbuser -p "dbpassword" -d flexibleserverdb \
107-
-q "select * from table1;" --output table
116+
-q "SELECT 1" --output table
108117
```
109118

110119
You'll see an output as shown below:
111120

112121
```output
113-
Command group 'postgres flexible-server' is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
114-
Successfully connected to postgresdemoserver.
115-
Ran Database Query: 'select * from table1;'
122+
Successfully connected to server372060240.
123+
Ran Database Query: 'SELECT 1'
116124
Retrieving first 30 rows of query output, if applicable.
117-
Closed the connection postgresdemoserver.
118-
Local context is turned on. Its information is saved in working directory C:\mydir. You can run `az local-context off` to turn it off.
119-
Your preference of are now saved to local context. To learn more, type in `az local-context --help`
120-
Txt Val
121-
----- -----
122-
test 200
123-
test 200
124-
test 200
125-
test 200
126-
test 200
127-
test 200
128-
test 200
125+
Closed the connection to server372060240
126+
?column?
127+
----------
128+
1
129129
```
130130

131131
## Run SQL File

0 commit comments

Comments
 (0)