Thread: External Tabular Data Via SQL

External Tabular Data Via SQL

From
David Fetter
Date:
Kind people,

Please find enclosed an example of what I hope to make into a
generalized way of accessing external tabular data via SQL.

It is written in PL/PerlU for portability reasons, although it could
probably be re-written in C at the cost of some large amount of
effort.  It depends on having Proc::ProcessTable installed.

init_ps() makes a process_table_type using Proc::ProcessTable.
get_ps() takes no arguments and returns a setof process_table_type,
and can be joined to, for example, pg_stat_activity.

Many thanks and kudos to Andrew Dunstan for helping me figure out the
niggly details.

This should go into a new section of contrib/ like sql_utils or some
such.

Big TIA for any hints, tips or pointers, especially to things I've
missed here. :)

Cheers,
D
--
David Fetter david@fetter.org http://fetter.org/
phone: +1 510 893 6100   mobile: +1 415 235 3778

Remember to vote!

Attachment

Re: External Tabular Data Via SQL

From
Josh Berkus
Date:
David,

> Please find enclosed an example of what I hope to make into a
> generalized way of accessing external tabular data via SQL.

This is very cool, and I look forward to playing with it.

However,it seems to me that pgFoundry is the place for it and not /contrib.   
We're really trying not to add new projects to contrib unless they're likely 
to get merged with the man code in a couple of versions.  Further, it's got a 
major external dependency.

Besides, other perl hackers are more likely to play with it if it's somewhere 
more accessable.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco


Re: External Tabular Data Via SQL

From
Andrew Dunstan
Date:

Josh Berkus wrote:

>David,
>
>  
>
>>Please find enclosed an example of what I hope to make into a
>>generalized way of accessing external tabular data via SQL.
>>    
>>
>
>This is very cool, and I look forward to playing with it.
>
>However,it seems to me that pgFoundry is the place for it and not /contrib.   
>We're really trying not to add new projects to contrib unless they're likely 
>to get merged with the man code in a couple of versions.  Further, it's got a 
>major external dependency.
>
>Besides, other perl hackers are more likely to play with it if it's somewhere 
>more accessable.
>  
>

Of course, if we had a nice code snippets feature working on pgfoundry 
that might be an ideal place for it ..... (That's a *big* *hint* BTW)

cheers

andrew