Tutorial using sqliteboy udf in python handler - nopri/sqliteboy GitHub Wiki

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')
  
⚠️ **GitHub.com Fallback** ⚠️