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

jebeld17 picture jebeld17  ·  3Comments

behnam89 picture behnam89  ·  3Comments

paulmarshall picture paulmarshall  ·  3Comments

ishepherd picture ishepherd  ·  3Comments

spottedmahn picture spottedmahn  ·  3Comments