""" Check uapi table data format """ import json async def main(): dbname = env.get_module_dbname('uapi') db = DBPools() async with db.sqlorContext(dbname) as sor: recs = await sor.sqlExe(""" SELECT id, name, stream, path, httpmethod, chunk_match, headers, data, response FROM uapi WHERE data IS NOT NULL AND data != '' OR response IS NOT NULL AND response != '' LIMIT 8 """, {}) results = [] for r in recs: results.append({ 'id': r.get('id',''), 'name': r.get('name',''), 'stream': r.get('stream',''), 'httpmethod': r.get('httpmethod',''), 'chunk_match': str(r.get('chunk_match',''))[:30], 'data': str(r.get('data',''))[:300], 'response': str(r.get('response',''))[:300], }) return {'count': len(results), 'samples': results}