@@ -124,7 +124,8 @@ def set_default_pager(self, config):
124124 def __init__ (self , force_passwd_prompt = False ,
125125 mssqlclirc_file = None , row_limit = None ,
126126 single_connection = False , less_chatty = None ,
127- auto_vertical_output = False , sql_tools_client = None , integrated_auth = False ):
127+ auto_vertical_output = False , sql_tools_client = None ,
128+ integrated_auth = False , enable_sqltoolsservice_logging = False ):
128129
129130 self .force_passwd_prompt = force_passwd_prompt
130131
@@ -193,7 +194,8 @@ def __init__(self, force_passwd_prompt=False,
193194 self .cli = None
194195
195196 # mssql-cli
196- self .sqltoolsclient = sql_tools_client if sql_tools_client else SqlToolsClient ()
197+ self .sqltoolsclient = sql_tools_client if sql_tools_client else SqlToolsClient (
198+ enable_logging = enable_sqltoolsservice_logging )
197199 self .mssqlcliclient_query_execution = None
198200 self .integrated_auth = integrated_auth
199201
@@ -695,9 +697,14 @@ def get_last_query(self):
695697 'detection and connection to currently active server.' )
696698@click .option ('-a' , '--packet-size' , default = 0 , type = int ,
697699 help = 'Size in bytes of the network packets used to communicate with SQL Server.' )
700+ @click .option ('-A' , '--dac-connection' , is_flag = True , default = False ,
701+ help = 'Connect to SQL Server using the dedicated administrator connection.' )
702+ @click .option ('--enable-sqltoolsservice-logging' , is_flag = True ,
703+ default = False ,
704+ help = 'Enables diagnostic logging for the SqlToolsService.' )
698705def cli (username , server , prompt_passwd , database , version , mssqlclirc , row_limit , less_chatty , auto_vertical_output ,
699706 integrated_auth , encrypt , trust_server_certificate , connect_timeout , application_intent , multi_subnet_failover ,
700- packet_size ):
707+ packet_size , enable_sqltoolsservice_logging , dac_connection ):
701708
702709 if version :
703710 print ('Version:' , __version__ )
@@ -712,9 +719,12 @@ def cli(username, server, prompt_passwd, database, version, mssqlclirc, row_limi
712719 integrated_auth = False
713720 print (u'Integrated authentication not supported on this platform' )
714721
722+ if dac_connection and server and not server .lower ().startswith ("admin:" ):
723+ server = "admin:" + server
724+
715725 mssqlcli = MssqlCli (prompt_passwd , row_limit = row_limit , single_connection = False ,
716726 mssqlclirc_file = mssqlclirc , less_chatty = less_chatty , auto_vertical_output = auto_vertical_output ,
717- integrated_auth = integrated_auth )
727+ integrated_auth = integrated_auth , enable_sqltoolsservice_logging = enable_sqltoolsservice_logging )
718728
719729 mssqlcli .connect (database , server , username , port = '' , encrypt = encrypt ,
720730 trust_server_certificate = trust_server_certificate , connection_timeout = connect_timeout ,
0 commit comments