e-Book: "Pentaho Solutions", Roland Bouman & Jos van Dongen, Wiley 2009 Book: "Pentaho Solutions", Roland Bouman & Jos van Dongen, Wiley 2009

Saturday, May 26, 2007

MySQL User Defined Function Repository

Welcome to the MySQL UDF Repository! The MySQL UDF repository aims to offer an organized collection of open source MySQL user defined functions.

There are numerous MySQL UDFs available in the public domain. However, most UDFs appear standalone. Often, binaries are not included: only the source code is available. In many cases, it is not straightforward to compile binaries for different platforms. Likewise, documentation and installation instructions are either scarce or missing. Also, there is little consistency with regard to naming conventions, error handling and error reporting.

The MySQL UDF Repository tries to improve that situation.

Goals

Here's a list of things the MySQL UDF Repository aims to offer:

  • Libraries that contain a coherent collection of UDFs instead of standalone, ad hoc functions.

  • Consistent approach with regard to naming conventions, error handling and error reporting.

  • Downloads of both source as well as binaries for popular platforms.

  • Online documentation that covers compilation, installation, implementation and examples.

  • Supporting scripts to compile and install and test the libraries.

  • All libraries released using a permissive open source license

How to participate


If you want to contribute or if you want to be kept up to date of this project, please mail to mysqludfs@gmail.com.

All response and feedback is welcome. When it turns out that there is a sufficient amount of interested people, we'll setup mailinglists and/or rss feeds.

4 comments:

Arnold Daniels said...

I've written a some UDF functions to generate XML directly in MySQL. It's based on SQL/XML, but unfortunately it doesn't have the same syntax since I could only define functions.

I've created a project for it on sourceforge. Little people found it yet though. Perhaps you can add a link to it.

http://libmyxql.sourceforge.net

MySQL UDF Repository Admin said...

Hi Arnold,

Yeah I saw your UDF collection, it's great! I am thinking of adding an xml library to the repository too, using the same semantics as lib_mysql_json, see:

http://xcdsql.org/MySQL/UDF/lib_mysqludf_json/lib_mysqludf_json.html

So, instead of having functions that require {name,value} pairs, you can simply re-use the expression text to generate a name, for example:

select json_object(
customer_id
, first_name
, last_name
, last_update
) as customer
from customer
where customer_id =1;


yields this result:

+---------------------------------------------------------------------------------------+
| customer |
+---------------------------------------------------------------------------------------+
| {customer_id:1,first_name:"MARY",last_name:"SMITH",last_update:"2006-02-15 04:57:20"} |
+---------------------------------------------------------------------------------------+

By treating all expressions that start with the prefix "json_ " as special, you can easily nest calls:

select json_object(
f.last_update
, json_members(
'film'
, json_object(
f.film_id
, f.title
, f.last_update
)
, 'category'
, json_object(
c.category_id
, c.name
, c.last_update
)
)
) as film_category
from film_category fc
inner join film f
on fc.film_id = f.film_id
inner join category c
on fc.category_id = c.category_id
where f.film_id =1;


yields a string representing the following JSON object (indentation added for readability):

{
last_update:"2006-02-15 05:03:42"
, film:{
film_id:1
, title:"ACADEMY DINOSAUR"
, last_update:"2006-02-15 05:03:42"
}
, category:{
category_id:6
, name:"Documentary"
, last_update:"2006-02-15 04:46:27"
}
}

That said, your library is of high quality, so it would be great if you could join the club:

http://groups.google.com/group/mysql-udf-repository

Welcome!

jean pierre porre said...

I was looking for a percentil udf function...and found yours, it seems to be the only one that works for large recordset (i have a 120000+ recordset), however i lack of knowledge in order to modify for my especific use. This is the thing: i have a table with a column for area, another one for product, and the price, i would like to know the percentil of each product un the table in reference to the area of this product, somthing like this could work Select area, product, price, function(area,product) as percentil from table where ..., can you help me?

Roland Bouman said...

Hi Jean Pierre,

I am not sure what function you are reffering too. I never wrote a UDF for percentiles.

I did write about other ways of computing the percentiles, you can search them:


http://rpbouman.blogspot.com/search?q=percentile

Post a Comment