Thread: fetching text file from internet
Hi to all. I need download text file from internet, and I'll use plpgsql, but I don't know if this language can do this. Ideas? Where I can find documentation more precisely than postgresql manual? Thank you, hi Billo Dario rodario@libero.it
Dario Billo wrote: > Hi to all. I need download text file from internet, and I'll use > plpgsql, but I don't know if this language can do this. Ideas? > Where I can find documentation more precisely than postgresql manual? I think you need something like plperl, plpython, or pltcl that knows how to make network connections. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
On Tue, Mar 15, 2005 at 10:30:49PM +0100, Dario Billo wrote: > Hi to all. I need download text file from internet, and I'll use > plpgsql, but I don't know if this language can do this. Ideas? Is there a reason you want to do this in server code instead of in the client? If you must implement download functionality on the server side, then you could write a function in C or one of the other PLs (PL/Perl, PL/Tcl, PL/Python, etc.) and call it from PL/pgSQL. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
I'd be surprised to find out that plpgsql could do this natively - it's not a database function you're trying to perform. Try using wget or curl to obtain the file in a shell script, then run your plpgsql to slurp in the **local** file. Rgds, Bret > -----Original Message----- > From: pgsql-novice-owner@postgresql.org > [mailto:pgsql-novice-owner@postgresql.org] On Behalf Of Dario Billo > Sent: Tuesday, March 15, 2005 4:31 PM > To: pgsql-novice@postgresql.org > Subject: [NOVICE] fetching text file from internet > > Hi to all. I need download text file from internet, and I'll > use plpgsql, but I don't know if this language can do this. Ideas? > Where I can find documentation more precisely than postgresql manual? > > Thank you, hi > > Billo Dario > rodario@libero.it > > > ---------------------------(end of > broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so > that your > message can get through to the mailing list cleanly >
In pl/perlu (and likely python, maybe others), you can easily download a file from the internet, parse it, and return results. If it is a type of file parseable by DBD::AnyData, then you could use dbi-link to make this file available as a table in your database. Sean On Mar 15, 2005, at 5:41 PM, Michael Fuhr wrote: > On Tue, Mar 15, 2005 at 10:30:49PM +0100, Dario Billo wrote: > >> Hi to all. I need download text file from internet, and I'll use >> plpgsql, but I don't know if this language can do this. Ideas? > > Is there a reason you want to do this in server code instead of in > the client? > > If you must implement download functionality on the server side, > then you could write a function in C or one of the other PLs (PL/Perl, > PL/Tcl, PL/Python, etc.) and call it from PL/pgSQL. > > -- > Michael Fuhr > http://www.fuhr.org/~mfuhr/ > > ---------------------------(end of > broadcast)--------------------------- > TIP 9: the planner will ignore your desire to choose an index scan if > your > joining column's datatypes do not match