Using sqlplus inside python to generate SQL output. Running this via flaskplus, the formatting is lost i.e. the characters like \n,\t are not getting rendered. Tried different ways to fix this but din't help. 'print' works but 'return' doesn't work fine.
@api.route('/db-health-report')
class runSqlQuery(Resource):
def get(self):
session = Popen(['sqlplus', '-S', connect_string], stdin=PIPE, stdout=PIPE, stderr=PIPE)
session.stdin.write(sql_command)
queryResult, errorMessage = session.communicate()
#print(queryResult, file=sys.stderr)
#return queryResult.decode('string_escape')
return queryResult