Greenplum Database Python custom functions

Source: Internet
Author: User
Tags parse error

The Greenplum Database (hereinafter referred to as the GP database) supports custom functions, and the following describes the custom simple functions written by Python. The clustering function is more complex and self-sensing is not suitable for the GP database.


The Python custom function describes what GP can do as long as Python can handle the row-level data.

Example: Python returns multiple rows for JSON processing.

Create or Replace function public.json_parse (data text) returns Setof text

As $$

Import JSON

Try

Mydata=json.loads (data)

Except

return [' Parse error ']

Returndata=[]

Try

For people in mydata[' a ']:

Returndata.append (people[' B ')

Except

return [' 223 ']

Return Returndata

$$ LANGUAGE Plpythonu;


This article is from the "11821925" blog, please be sure to keep this source http://11831925.blog.51cto.com/11821925/1836434

Greenplum Database Python custom functions

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.