PostgreSQL Server Programming Second Edition by Second Edition
Author:Second Edition
Language: eng
Format: epub
Publisher: Packt Publishing
Functions returning a record
To return a record from a Python function, you can use:
A sequence or list of values in the same order as the fields in the return record
A dictionary with keys matching the fields in the return record
A class or type instance with attributes matching the fields in the return record
Here are samples of the three ways to return a record:
First, using an instance:
CREATE OR REPLACE FUNCTION userinfo( INOUT username name, OUT user_id oid, OUT is_superuser boolean) AS $$ class PGUser: def __init__(self,username,user_id,is_superuser): self.username = username self.user_id = user_id self.is_superuser = is_superuser u = plpy.execute("""\ select usename,usesysid,usesuper from pg_user where usename = '%s'""" % username)[0] user = PGUser(u['usename'], u['usesysid'], u['usesuper']) return user $$ LANGUAGE plpythonu;
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Access | Data Mining |
Data Modeling & Design | Data Processing |
Data Warehousing | MySQL |
Oracle | Other Databases |
Relational Databases | SQL |
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8293)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6689)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6664)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6537)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6326)
Driving Data Quality with Data Contracts by Andrew Jones(6277)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6044)
Learning SQL by Alan Beaulieu(5988)
Weapons of Math Destruction by Cathy O'Neil(5778)
Big Data Analysis with Python by Ivan Marin(5338)
Data Engineering with dbt by Roberto Zagni(4340)
Solidity Programming Essentials by Ritesh Modi(3985)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3841)
Pandas Cookbook by Theodore Petrou(3551)
Blockchain Basics by Daniel Drescher(3292)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2900)
Feature Store for Machine Learning by Jayanth Kumar M J(2808)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2791)
Mastering Python for Finance by Unknown(2743)
