Skip to content

Commit 6a5fa1c

Browse files
committed
fix delete
1 parent b723b93 commit 6a5fa1c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

main.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def cleanup(*args):
4949

5050
DUMP_CMD = 'mysqldump -h {host} -P {port} -u {user} --password={password} {db} {table} ' \
5151
'--default-character-set=utf8 -X'.format(**config['mysql'])
52-
REMOVE_INVALID_CHAR_CMD = 'iconv -f utf-8 -t utf-8 -c'
52+
# REMOVE_INVALID_CHAR_CMD = 'iconv -f utf-8 -t utf-8 -c'
5353

5454
BINLOG_CFG = {key: config['mysql'][key] for key in ['host', 'port', 'user', 'password', 'db']}
5555
BULK_SIZE = config.get('elastic').get('bulk_size')
@@ -147,7 +147,7 @@ def processor(data):
147147
body = json.dumps({'doc': item['doc']}, default=json_serializer)
148148
rv = meta + '\n' + body
149149
elif item['action'] == 'delete':
150-
rv = json.dumps(item['doc'], default=json_serializer) + '\n'
150+
rv = meta + '\n'
151151
elif item['action'] == 'create':
152152
body = json.dumps(item['doc'], default=json_serializer)
153153
rv = meta + '\n' + body
@@ -306,13 +306,15 @@ def xml_dump_loader():
306306
stderr=subprocess.DEVNULL,
307307
close_fds=True)
308308

309-
removed_invalid_char = subprocess.Popen(
310-
shlex.split(REMOVE_INVALID_CHAR_CMD),
311-
stdin=mysqldump.stdout,
312-
stdout=subprocess.PIPE,
313-
stderr=subprocess.DEVNULL,
314-
close_fds=True)
315-
return removed_invalid_char.stdout # can be used as file object. (stream io)
309+
# removed_invalid_char = subprocess.Popen(
310+
# shlex.split(REMOVE_INVALID_CHAR_CMD),
311+
# stdin=mysqldump.stdout,
312+
# stdout=subprocess.PIPE,
313+
# stderr=subprocess.DEVNULL,
314+
# close_fds=True)
315+
# return removed_invalid_char.stdout # can be used as file object. (stream io)
316+
return mysqldump.stdout
317+
316318

317319
def xml_file_loader(filename):
318320
f = open(filename, 'rb') # bytes required

0 commit comments

Comments
 (0)