#NEWLINE# def create_connect_args( self , url ) : #NEWLINE# #INDENT# opts = url . translate_connect_args ( username = 'user' ) #NEWLINE# opts . update ( url . query ) #NEWLINE# keys = opts #NEWLINE# query = url . query #NEWLINE# connect_args = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for param in ( 'ansi' , 'unicode_results' , 'autocommit' ) : #NEWLINE# #INDENT# if ( param in keys ) : #NEWLINE# #INDENT# connect_args [ param ] = util . asbool ( keys . pop ( param ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( 'odbc_connect' in keys ) : #NEWLINE# #INDENT# connectors = [ util . unquote_plus ( keys . pop ( 'odbc_connect' ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dsn_connection = ( ( 'dsn' in keys ) or ( ( 'host' in keys ) and ( 'database' not in keys ) ) ) #NEWLINE# if dsn_connection : #NEWLINE# #INDENT# connectors = [ ( 'dsn=%s' % ( keys . pop ( 'host' , '' ) or keys . pop ( 'dsn' , '' ) ) ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# port = '' #NEWLINE# if ( ( 'port' in keys ) and ( 'port' not in query ) ) : #NEWLINE# #INDENT# port = ( ',%d' % int ( keys . pop ( 'port' ) ) ) #NEWLINE# #UNINDENT# connectors = [ ( 'DRIVER={%s}' % keys . pop ( 'driver' , self . pyodbc_driver_name ) ) , ( 'Server=%s%s' % ( keys . pop ( 'host' , '' ) , port ) ) , ( 'Database=%s' % keys . pop ( 'database' , '' ) ) ] #NEWLINE# #UNINDENT# user = keys . pop ( 'user' , None ) #NEWLINE# if user : #NEWLINE# #INDENT# connectors . append ( ( 'UID=%s' % user ) ) #NEWLINE# connectors . append ( ( 'PWD=%s' % keys . pop ( 'password' , '' ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# connectors . append ( 'Trusted_Connection=Yes' ) #NEWLINE# #UNINDENT# if ( 'odbc_autotranslate' in keys ) : #NEWLINE# #INDENT# connectors . append ( ( 'AutoTranslate=%s' % keys . pop ( 'odbc_autotranslate' ) ) ) #NEWLINE# #UNINDENT# connectors . extend ( [ ( '%s=%s' % ( k , v ) ) for ( k , v ) in keys . items ( ) ] ) #NEWLINE# #UNINDENT# return [ [ ';' . join ( connectors ) ] , connect_args ]