You have two options; Use of the Orion REST API or direct to SQL database, with the benefits of going via the API being adherence to Account Limitation permissions and abstraction from DB schema changes. Benefits of going direct to database, primarily lie in performance.
It would be useful for others if you post your results
SolarWinds solutions are rooted in our deep connection to our user base in the THWACK® online community. More than 150,000 members are here to solve problems, share technology and best practices, and directly contribute to our product development process.