Browse Source

bug fix: write to SQL complex objects -> str

Steve Nyemba 1 năm trước cách đây
mục cha
commit
0d7b40cbd8
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      healthcareio/x12/parser.py

+ 5 - 1
healthcareio/x12/parser.py

@@ -158,7 +158,11 @@ class X12Parser(BasicParser):
             _store['cotnext'] = 'write'
             _writer = transport.factory.instance(**_store)                    
             # if _store['provider'] not in [providers.MONGODB, providers.COUCHDB] :
-               
+
+            for _document in _documents :
+                for field in _document :
+                    if type(_document[field]) in [dict,list] :
+                        _document[field] = json.dumps(_document[field],default=str)
                 
             _writer.write(_documents,table=TABLE)
             if getattr(_writer,'close') :