Personal tools
You are here: Home WiKi dumpykota

dumpykota

Document Actions
last edited 10 years ago by jdhoivik

If you want to reuse PyKota's datas from another software, but don't want to modify your existing application to have it connect to PyKota's DataBase?, your best option is the dumpykota command.

dumpykota can export PyKota's datas in a number of formats. The supported output formats are comma separated values, semicolon separated values, tab separated values, and XML.

For the print job history's datas, a special format identical to CUPS' page_log format is also supported. This allows you to interface PyKota with third party tools like phpPrintAnalyzer which is a logfile analyzer for CUPS.

More formats may be added in the future. In particular, SQL and LDIF are planned, but are currently not implemented.

dumpykota can also dump all datas at once if you want. The possible dump data types are :

  • Users
  • Users groups
  • Printers
  • Printers groups membership
  • Users groups membership
  • Users print quota entries
  • Users groups print quota entries
  • History of payments
  • History of print jobs
  • Billing codes
  • All (NB : when dumping All datas, the output format is forced to XML, and filters are disabled)

You can then import the dumped datas into a spreadsheet for example, if you want to create complex reports with nice looking graphs and the like.

An important feature of this command is the possibility to use a simple but powerful filtering mechanism to only export the datas you want. You can pass any number of filter expressions which will be ANDed? together to select only certain records in the database. For example the filter expression username=jerome would only dump datas pertaining to user jerome while the filter expression start=2005 used when dumping the history would only dump jobs printed during the year 2005. However when dumping the complete database, filters can't be used.

Several keys like username are possible, but some only apply to certain data types. Using a key which is not supported for a particular data type may return an incorrect result.

For date keys, you have to use the start= and end= key syntax to specify starting and ending dates of the datas to extract (from the history or payments). These keys accept a special syntax in which the following formats are recognized :

  • YYYY : year boundaries
  • YYYYMM : month boundaries
  • YYYYMMDD : day boundaries
  • YYYYMMDDhh : hour boundaries
  • YYYYMMDDhhmm : minute boundaries
  • YYYYMMDDhhmmss : second boundaries
  • yesterday +- NbDays : yesterday more or less N days (e.g. : yesterday-15)
  • today +- NbDays : today more or less N days (e.g. : today-15)
  • tomorrow +- NbDays : tomorrow more or less N days (e.g. : tomorrow-15)
  • now +- NbDays : now more or less N days (e.g. now-15)

now and today are not exactly the same since today represents the first or last second of the day depending on if it's used in a start= or end= date expression. The utility to be able to specify dates in the future is a question which remains to be answered :-)

Please refer to the help or manual page of the dumpykota command to obtain the complete list of supported keys.

This command could also be used if you plan to write your own management tools : just write wrappers around the pkprinters, edpykota, pkbcodes and dumpykota tools, and your own tools will automatically benefit from PyKota's DataBase? backend independance layer. This is exactly what the third party software phpPykotaAdmin does.

Finally, the functionnalities of dumpykota are also available remotely through the use of the dumpykota.cgi CGI script.

Warning :

Only PyKotaAdministrators can dump PyKota's datas.

subtopics:


comments:

dumpykota.cgi --jdhoivik, Thu, 29 Mar 2007 12:42:25 +0200 reply


Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: