azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

az postgres up: When creating a database, the printed connection string for Python wasn't useful

Open chenlomis opened this issue 6 years ago • 5 comments

az feedback auto-generates most of the information requested below, as of CLI version 2.0.62

Describe the bug " When creating a database, the printed connection string for Python wasn't useful.

I ended up copying the information I needed from the Java/JDBC connection string instead.

(removed link)

To Reproduce Steps to reproduce the behavior.

Expected behavior A clear and concise description of what you expected to happen.

Environment summary Install Method (e.g. pip, interactive script, apt-get, Docker, MSI, edge build) / CLI version (az --version) / OS version / Shell Type (e.g. bash, cmd.exe, Bash on Windows)

Additional context Add any other context about the problem here.

chenlomis avatar Dec 20 '19 18:12 chenlomis

add to S164.

yonzhan avatar Dec 21 '19 12:12 yonzhan

Printed message during deployment.

Creating PostgreSQL Server 'server017526815' in group 'zuh'...
Creating PostgreSQL database 'sampledb'...
Checking your ip address...
Configuring server firewall rule, 'devbox', to allow for your ip address: 167.220.255.1
If PostgreSQL server declines your IP address, please create a new firewall rule using:
	 `az postgres server firewall-rule create -g zuh -s server017526815 -n {rule_name} --start-ip-address {ip_address} --end-ip-address {ip_address}`
Configuring server firewall rule, 'azure-access', to accept connections from all Azure resources...
Successfully Connected to PostgreSQL.
Ran Database Query: `CREATE USER root WITH ENCRYPTED PASSWORD 'Sampledb1'`
Ran Database Query: `GRANT ALL PRIVILEGES ON DATABASE sampledb TO root`

Juliehzl avatar Mar 12 '20 15:03 Juliehzl

any feedback for this issue?

yonzhan avatar Mar 28 '20 02:03 yonzhan

@chenlomis Thanks for having created this issue. As of today, the JSON returned after the command executes successfully includes a connectionStrings nested object whose python attribute has a valid connection string to be used from Python, provided you've imported psycopg2 library.

nachoalonsoportillo avatar Jul 04 '24 22:07 nachoalonsoportillo

@yonzhan Please, close this issue. Thanks!

nachoalonsoportillo avatar Jul 04 '24 22:07 nachoalonsoportillo