{u'status': None, u'tax': 3.6, u'entity': u'payment', u'currency': u'INR', u'id': u'128934802340', }
db.mytable.insert(**db.mytable._filter_fields(record_dict))
Field('tax', rname='sales_tax')
db.mytable.insert(field1=record['field1'], field2=record['field2_alt_spelling'], ...)
db.mytable.insert(field1=record['field1'], field2=record['field2_alt_spelling'], ...)
TypeError: string indices must be integers
Thanks! Anthony for guiding me on this. Always #1 for helping us out.
Now there is one last thing and it may be trivial but can you point me to the right direction. I used below notation. This works fine if I have a single record
db.mytable.insert(field1=record['field1'], field2=record['field2_alt_spelling'], ...)
However, if I have multiple records, it fails with a type error given below
TypeError: string indices must be integers
Data is in this format -
{u'count': 6, u'items': [{u'refund_status': None, u'tax': None, u'entity': u'payment', u'currency': u'INR', u'id': u'Tq99121U7', u'captured': False, u'fee': None, u'international': False, u'email': u'hel...@gmail.com', u'status': u'failed', u'amount_refunded': 0, u'description': u'Purchase Description', u'order_id': None, u'vpa': None, u'bank': None, u'invoice_id': None, u'notes': [], u'card_id': u'311645', u'method': u'card', u'wallet': None, u'amount': 100, u'contact': u'7001394', u'error_description': u'Payment failed', u'error_code': u'BAD_REQUEST_ERROR', u'created_at': 15138345825},
{u'refund_status': ......},
{u'refund_status': None, .... 1513940199} ,
{u'refund_status': None, u'created_at': 1513738859},
for record in data['items']:
db.mytable.insert(field1=record['field1'], ...)
allrecords = c.payment.all() # Fetches all the records
for myrecord in allrecords['items']:
webdbase.database.insert(.....
On Thursday, January 11, 2018 at 6:39:38 AM UTC-5, Rahul wrote:
Thanks! Anthony for guiding me on this. Always #1 for helping us out.
Now there is one last thing and it may be trivial but can you point me to the right direction. I used below notation. This works fine if I have a single record
db.mytable.insert(field1=record['field1'], field2=record['field2_alt_spelling'], ...)
However, if I have multiple records, it fails with a type error given below
TypeError: string indices must be integers
Data is in this format -
{u'count': 6, u'items': [{u'refund_status': None, u'tax': None, u'entity': u'payment', u'currency': u'INR', u'id': u'Tq99121U7', u'captured': False, u'fee': None, u'international': False, u'email': u'he...@gmail.com', u'status': u'failed', u'amount_refunded': 0, u'description': u'Purchase Description', u'order_id': None, u'vpa': None, u'bank': None, u'invoice_id': None, u'notes': [], u'card_id': u'311645', u'method': u'card', u'wallet': None, u'amount': 100, u'contact': u'7001394', u'error_description': u'Payment failed', u'error_code': u'BAD_REQUEST_ERROR', u'created_at': 15138345825},
{u'refund_status': ......},
{u'refund_status': None, .... 1513940199} ,
{u'refund_status': None, u'created_at': 1513738859},