Skip to content

Commit a97348c

Browse files
committed
dev: add shell quotation
1 parent 6071b03 commit a97348c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clickhouse_mysql/writer/chcsvwriter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# -*- coding: utf-8 -*-
33

44
import os
5-
import time
65
import logging
6+
import shlex
77

88
from clickhouse_mysql.writer.writer import Writer
99
from clickhouse_mysql.tableprocessor import TableProcessor
@@ -80,13 +80,13 @@ def insert(self, event_or_events=None):
8080

8181
choptions = ""
8282
if self.host:
83-
choptions += " --host=" + self.host
83+
choptions += " --host=" + shlex.quote(self.host)
8484
if self.port:
8585
choptions += " --port=" + str(self.port)
8686
if self.user:
87-
choptions += " --user=" + self.user
87+
choptions += " --user=" + shlex.quote(self.user)
8888
if self.password:
89-
choptions += " --password=" + self.password
89+
choptions += " --password=" + shlex.quote(self.password)
9090
bash = "tail -n +2 '{0}' | clickhouse-client {1} --query='{2}'".format(
9191
event.filename,
9292
choptions,

0 commit comments

Comments
 (0)