pyreports is a python library that allows you to create complex reports from various sources such as databases, text files, ldap, etc. and perform processing, filters, counters, etc. and then export or write them in various formats or in databases.

How does pyreports work?

pyreports wants to be a library that simplifies the collection of data from multiple sources such as databases, files and directory servers (through LDAP), the processing of them through built-in and customized functions, and the saving in various formats (or, by inserting the data in a database).

Features

  • Write for Python 3.6 and high
  • Each database connection is DBAPI 2.0 compliant
  • Each NoSQL database connection is nosqlapi compliant
  • Work with Dataset objects
  • All objects are extensible
  • Functions that support data modification
  • Data exports to Excel, CSV, YAML, Json and more.
  • Send exported data to email

Install

    $ pip install pyreports

How to use it?

import pyreports

# Select source: this is a DatabaseManager object
mydb = pyreports.manager('mysql', host='mysql1.local', database='login_users', user='dba', password='dba0000')

# Get data
mydb.execute('SELECT * FROM site_login')
site_login = mydb.fetchall()

# Filter data
error_login = pyreports.Executor(site_login)
error_login.filter([400, 401, 403, 404, 500])

# Save report: this is a FileManager object
output = pyreports.manager('csv', '/home/report/error_login.csv')
output.write(error_login.get_data())
    


License

  • GPL-3.0 license.

Resources