From 0d7b40cbd83fb011a70214120ef459d04c7ee91c Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Mon, 19 Feb 2024 22:10:26 -0600 Subject: [PATCH] bug fix: write to SQL complex objects -> str --- healthcareio/x12/parser.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/healthcareio/x12/parser.py b/healthcareio/x12/parser.py index 71fd49d..536efe9 100644 --- a/healthcareio/x12/parser.py +++ b/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') :