From djoo@vistagen-inc.com Tue Aug 1 22:37:49 2006 X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 69F489FA432 for ; Tue, 1 Aug 2006 19:37:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 55972-01 for ; Tue, 1 Aug 2006 19:37:40 -0300 (ADT) X-Greylist: delayed 00:06:39.248121 by SQLgrey- Received: from smtp105.sbc.mail.mud.yahoo.com (smtp105.sbc.mail.mud.yahoo.com [68.142.198.204]) by postgresql.org (Postfix) with SMTP id 4B60E9FB1D4 for ; Tue, 1 Aug 2006 19:37:39 -0300 (ADT) Received: (qmail 97558 invoked from network); 1 Aug 2006 22:30:58 -0000 Received: from unknown (HELO DMJVGEN) (franklin.rice@sbcglobal.net@64.165.39.190 with login) by smtp105.sbc.mail.mud.yahoo.com with SMTP; 1 Aug 2006 22:30:58 -0000 From: "Daniel Joo" To: Subject: viewing the description of tables from python DB-API Date: Tue, 1 Aug 2006 15:30:48 -0700 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000E_01C6B57F.77369E20" X-Mailer: Microsoft Office Outlook, Build 11.0.6353 thread-index: Aca1uiLD8WPVQWF+R8KxpY2sxFHYVg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 Message-Id: <20060801223740.4B60E9FB1D4@postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.394 tagged_above=0 required=5 tests=HTML_MESSAGE, MSGID_FROM_MTA_ID X-Spam-Level: * X-Archive-Number: 200608/5 X-Sequence-Number: 25963 This is a multi-part message in MIME format. ------=_NextPart_000_000E_01C6B57F.77369E20 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Hi all, 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. Thanks very much! Dan ------=_NextPart_000_000E_01C6B57F.77369E20 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi all,

 

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. 

 

Thanks very much!

 

Dan

 

------=_NextPart_000_000E_01C6B57F.77369E20-- From alvherre@commandprompt.com Tue Aug 1 23:00:58 2006 X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id D000C9FB1D4 for ; Tue, 1 Aug 2006 20:00:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57413-03 for ; Tue, 1 Aug 2006 20:00:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from lists.commandprompt.com (host-130.commandprompt.net [207.173.203.130]) by postgresql.org (Postfix) with ESMTP id E44769FB36A for ; Tue, 1 Aug 2006 20:00:47 -0300 (ADT) Received: from alvh.no-ip.org (200-126-100-4.bk7-dsl.surnet.cl [200.126.100.4]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id k71N0jV3026332; Tue, 1 Aug 2006 16:00:45 -0700 Received: by alvh.no-ip.org (Postfix, from userid 1000) id C6352C2F879; Tue, 1 Aug 2006 19:00:39 -0400 (CLT) Date: Tue, 1 Aug 2006 19:00:39 -0400 From: Alvaro Herrera To: Daniel Joo Cc: pgsql-sql@postgresql.org Subject: Re: viewing the description of tables from python DB-API Message-ID: <20060801230039.GA20401@alvh.no-ip.org> Mail-Followup-To: Daniel Joo , pgsql-sql@postgresql.org References: <20060801223740.4B60E9FB1D4@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20060801223740.4B60E9FB1D4@postgresql.org> User-Agent: Mutt/1.5.12-2006-07-14 X-Virus-Scanned: ClamAV version 0.88.3, clamav-milter version 0.88.3 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 01 Aug 2006 16:00:50 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.914 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200608/6 X-Sequence-Number: 25964 Daniel Joo 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. Try \d under psql -E sometime. It'll give you the query it uses. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support From rdeleonp@gmail.com Tue Aug 1 23:14:10 2006 X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 922B79FB1D4 for ; Tue, 1 Aug 2006 20:14:10 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 57341-09 for ; Tue, 1 Aug 2006 20:14:07 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by postgresql.org (Postfix) with ESMTP id 2B47F9FB1C3 for ; Tue, 1 Aug 2006 20:14:06 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id m3so1544940ugc for ; Tue, 01 Aug 2006 16:14:03 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HD+9bR/Mp+zX4lIOQ3mR56SekeN+K8m07+8gREi6sEZqD3JKzYuWrkdE9a6qal1H+5bbRgvcPwTzzEPA66A6UTjWwNLdAuBkpAz8okWH2kEPQ7831V6n2TRvk+60kGjWze+WCO/1STD+XR1GeugTRGrCNVX8+iPxR7mN2OwgLTI= Received: by 10.67.93.6 with SMTP id v6mr282049ugl; Tue, 01 Aug 2006 16:14:03 -0700 (PDT) Received: by 10.66.234.13 with HTTP; Tue, 1 Aug 2006 16:14:03 -0700 (PDT) Message-ID: Date: Tue, 1 Aug 2006 17:14:03 -0600 From: "Rodrigo De Leon" To: pgsql-sql@postgresql.org Subject: Re: viewing the description of tables from python DB-API In-Reply-To: <20060801223740.4B60E9FB1D4@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20060801223740.4B60E9FB1D4@postgresql.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.2 tagged_above=0 required=5 tests=AWL, DNS_FROM_RFC_ABUSE, SPF_PASS X-Spam-Level: X-Archive-Number: 200608/7 X-Sequence-Number: 25965 On 8/1/06, Daniel Joo wrote: > Hi all, > > > > 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. > > > > Thanks very much! > > > > Dan There's also the INFORMATION_SCHEMA: http://www.postgresql.org/docs/8.1/static/information-schema.html Regards, Rodrigo From smarlowe@g2switchworks.com Wed Aug 2 16:23:13 2006 X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 660639FA491 for ; Wed, 2 Aug 2006 13:23:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 65901-06 for ; Wed, 2 Aug 2006 13:23:05 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from exchange.g2switchworks.com (mail.g2switchworks.com [63.87.162.25]) by postgresql.org (Postfix) with ESMTP id 215CF9F9B01 for ; Wed, 2 Aug 2006 13:23:05 -0300 (ADT) Received: from 10.10.1.37 ([10.10.1.37]) by exchange.g2switchworks.com ([10.10.1.2]) with Microsoft Exchange Server HTTP-DAV ; Wed, 2 Aug 2006 16:22:54 +0000 Received: from state.g2switchworks.com by mail.g2switchworks.com; 02 Aug 2006 11:22:54 -0500 Subject: Re: viewing the description of tables from python DB-API From: Scott Marlowe To: Rodrigo De Leon Cc: pgsql-sql@postgresql.org In-Reply-To: References: <20060801223740.4B60E9FB1D4@postgresql.org> Content-Type: text/plain Content-Transfer-Encoding: 7bit Message-Id: <1154535774.7882.42.camel@state.g2switchworks.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Wed, 02 Aug 2006 11:22:54 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.07 tagged_above=0 required=5 tests=AWL, SPF_PASS, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200608/17 X-Sequence-Number: 25975 On Tue, 2006-08-01 at 18:14, Rodrigo De Leon wrote: > On 8/1/06, Daniel Joo wrote: > > Hi all, > > > > > > > > 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. > > > > > > > > Thanks very much! > > > > > > > > Dan > > There's also the INFORMATION_SCHEMA: > > http://www.postgresql.org/docs/8.1/static/information-schema.html Quick note. The INFORMATION_SCHEMA should stay pretty static from one pgsql version to the next, while the queries that psql -E shows will likely change from one version to another. From gry@ll.mit.edu Mon Aug 7 19:40:24 2006 X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id E832F9FB36A for ; Mon, 7 Aug 2006 16:40:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 46487-08-2 for ; Mon, 7 Aug 2006 16:40:14 -0300 (ADT) X-Greylist: delayed 00:18:29.554614 by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 434029FB22F for ; Mon, 7 Aug 2006 16:39:50 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.3 Received: from ll.mit.edu (LLMAIL.LL.MIT.EDU [129.55.12.40]) by svr4.postgresql.org (Postfix) with ESMTP id 7AD545AFB3E for ; Mon, 7 Aug 2006 19:21:18 +0000 (GMT) Received: (from smtp@localhost) by ll.mit.edu (8.12.10/8.8.8) id k77JKwBn006624 for ; Mon, 7 Aug 2006 15:20:58 -0400 (EDT) Received: from UNKNOWN( ), claiming to be "sty.llan" via SMTP by llmail, id smtpdAAA.AaGml; Mon Aug 7 15:20:32 2006 Date: Mon, 7 Aug 2006 15:20:31 -0400 From: George Young To: pgsql-sql@postgresql.org Subject: Re: viewing the description of tables from python DB-API Message-Id: <20060807152031.e3e1ef59.gry@ll.mit.edu> In-Reply-To: <20060801223740.4B60E9FB1D4@postgresql.org> References: <20060801223740.4B60E9FB1D4@postgresql.org> Organization: MIT Lincoln Laboratory X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.0; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200608/43 X-Sequence-Number: 26001 On Tue, 1 Aug 2006 15:30:48 -0700 "Daniel Joo" 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)