Azure-docs: Improve python example

Created on 26 Mar 2018  Â·  3Comments  Â·  Source: MicrosoftDocs/azure-docs

  1. In the connection string, the PORT is written twice, instead of only once.

  2. Use string.format, to create the connection string, it is much nicer and pythonic.

For example:

server = "server"                                                                                                   
username = "username"                                                                                                                             
password = "password"                                                                                                 
driver= '{ODBC Driver 13 for SQL Server}'                                                                                                     
database = "database"                                                                                                                          

connection_string = 'DRIVER={driver};PORT=1433;SERVER={server};DATABASE={database};UID={username};PWD={password}'.format(
    driver=driver, server=server, database=database, username=username, password=password)

Thanks


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

assigned-to-author doc-bug sql-databassvc triaged

Most helpful comment

@bityob Thanks - good catch - fixing now.

All 3 comments

@bityob Thanks - good catch - fixing now.

@bityob fix will be live at 4 PM today

please-close

Was this page helpful?
0 / 5 - 0 ratings

Related issues

spottedmahn picture spottedmahn  Â·  3Comments

jharbieh picture jharbieh  Â·  3Comments

JeffLoo-ong picture JeffLoo-ong  Â·  3Comments

JamesDLD picture JamesDLD  Â·  3Comments

behnam89 picture behnam89  Â·  3Comments