Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Tutorial using sqliteboy udf in python handler

Noprianto edited this page Jul 3, 2013 · 4 revisions

Tutorial: Using SQLiteBoy UDF in Python Handler

In this tutorial, we will use SQLiteBoy user-defined functions in python handler of form/report.

Function signature for python handler of form/report:

  form_<form_name>(user, db, parsed, user_data, data)

  report_<report_name>(user, db, parsed, user_data, data)
  

We will use last argument: data. For another arguments, please read PYTHON HANDLER REFERENCE in SQLiteBoy Documentation.

To get reference to all SQLiteBoy user-defined functions, please get udf key in data (dictionary).

  
  udf = data.get('udf')
  

What we get is also a dictionary (key: user-defined function name).

The example below shows how to work with sqliteboy_number_to_words function.

  number_to_words = udf.get('sqliteboy_number_to_words')

  print number_to_words('-123456789123456789123456789.123456789', 'en1')