def __init__(self, command=None, name="", log=None, prompt="[#\$] "): if command is None: command = ["/bin/bash", "--noediting"] self.prompt = prompt self.client = uexpect.spawn(command) self.client.eol("\r") self.client.logger(log, prefix=name) self.client.timeout(20) self.client.expect(prompt, timeout=60)
def __init__(self, command=None, name='', log=None, prompt='[#\$] '): if command is None: command = ['/bin/bash', '--noediting'] self.prompt = prompt self.client = uexpect.spawn(command) self.client.eol('\r') self.client.logger(log, prefix=name) self.client.timeout(20) self.client.expect(prompt, timeout=60)
def __init__(self, command=None, name='', log=None): self.client = uexpect.spawn(['/bin/bash', '--noediting']) if command is None: command = '/usr/bin/clickhouse-client' self.client.command = command self.client.eol('\r') self.client.logger(log, prefix=name) self.client.timeout(20) self.client.expect('[#\$] ', timeout=2) self.client.send(command)
def __init__(self, command=None, name='', log=None): self.client = uexpect.spawn(['/bin/bash', '--noediting']) if command is None: command = os.environ.get('CLICKHOUSE_BINARY', 'clickhouse') + ' client' self.client.command = command self.client.eol('\r') self.client.logger(log, prefix=name) self.client.timeout(20) self.client.expect('[#\$] ', timeout=60) self.client.send(command)
def __init__(self, command=None, name="", log=None): self.client = uexpect.spawn(["/bin/bash", "--noediting"]) if command is None: command = os.environ.get("CLICKHOUSE_BINARY", "clickhouse") + " client" self.client.command = command self.client.eol("\r") self.client.logger(log, prefix=name) self.client.timeout(120) self.client.expect("[#\$] ", timeout=60) self.client.send(command)
def __init__(self, command=None, name='', log=None): self.client = uexpect.spawn(['/bin/bash', '--noediting']) if command is None: command = f'mysql --user default -N -s' tcp_host = os.getenv("QUERY_MYSQL_HANDLER_HOST") if tcp_host is not None: command += f' --host={tcp_host}' else: command += f' --host=127.0.0.1' command += f' --prompt "{prompt}"' tcp_port = os.getenv("QUERY_MYSQL_HANDLER_PORT") if tcp_port is not None: command += f" --port={tcp_port}" else: command += f" --port=3307" self.client.command = command self.client.eol('\r') self.client.logger(log, prefix=name) self.client.timeout(120) self.client.expect('[#\$] ', timeout=60) self.client.send(command)