File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ def encode_in_py2(s):
2727from pymysqlreplication import BinLogStreamReader
2828from pymysqlreplication .row_event import DeleteRowsEvent , UpdateRowsEvent , WriteRowsEvent
2929
30- __version__ = '0.3.0 '
30+ __version__ = '0.3.2 '
3131
3232
3333# The magic spell for removing invalid characters in xml stream.
@@ -62,7 +62,7 @@ def __init__(self):
6262 type = self .config ['elastic' ]['type' ]
6363 ) # todo: supporting multi-index
6464
65- self .mapping = self .config .get ('mapping' )
65+ self .mapping = self .config .get ('mapping' ) or {}
6666 if self .mapping .get ('_id' ):
6767 self .id_key = self .mapping .pop ('_id' )
6868 else :
@@ -185,9 +185,10 @@ def _mapper(self, data):
185185 mapping old key to new key
186186 """
187187 for item in data :
188- for k , v in self .mapping .items ():
189- item ['doc' ][k ] = item ['doc' ][v ]
190- del item ['doc' ][v ]
188+ if self .mapping :
189+ for k , v in self .mapping .items ():
190+ item ['doc' ][k ] = item ['doc' ][v ]
191+ del item ['doc' ][v ]
191192 # print(doc)
192193 yield item
193194
You can’t perform that action at this time.
0 commit comments