Re: [SQL] viewing the description of tables from python DB-API
On Tue, 1 Aug 2006 15:30:48 -0700 "Daniel Joo" <[EMAIL PROTECTED]> wrote: > Is there a way to view the list of all tables from python (or any other > languages for that matter) DB-API? What I'm looking for is a command > similar to the meta-command '\d' that works with the psql client. The cursor object has a "description" data member. Look at the DB-API spec: http://www.python.org/dev/peps/pep-0249/ under "Cursor Objects". Python 2.3.3 (#1, Jan 3 2004, 07:17:11) [GCC 3.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import pgdb >>> db=pgdb.connect(database='pigrestore', host='ivy') >>> cur=db.cursor() >>> cur.execute('select * from machine') >>> print cur.description [('machine_name', 'text', -1, -1, None, None, None), ('machine_id', 'int2', -1, 2, None, None, None), ('area', 'text', -1, -1, None, None, None), ('text', 'text', -1, -1, None, None, None)] >>> -- "Are the gods not just?" "Oh no, child. What would become of us if they were?" (C.S. Lewis) ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster
[SQL] Change of data type
Hello everybody, excuse me how can I change de data type of a field, I currently have: material character(30) but I now want the field in text type like this: material text somebody knows if ALTER TABLE has some option to do this?, or How can I do that? ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [SQL] Change of data type
On pg8, to change tab.col to type t: alter table tab alter column col type t so: alter table tab alter column material type text -j Judith wrote: Hello everybody, excuse me how can I change de data type of a field, I currently have: material character(30) but I now want the field in text type like this: material text somebody knows if ALTER TABLE has some option to do this?, or How can I do that? ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org