Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.kamp.net!newsfeed.kamp.net!87.79.20.101.MISMATCH!newsreader4.netcologne.de!news.netcologne.de!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'resulting': 0.04; '"""': 0.07; 'attribute': 0.07; 'pyodbc': 0.09; 'read-only': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'dictionary.': 0.16; 'none.': 0.16; 'precision,': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:More': 0.16; 'tuples,': 0.16; 'url:home': 0.24; 'tables': 0.26; 'values': 0.27; 'header:X-Complaints-To:1': 0.27; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'example,': 0.37; 'list': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'email addr:gmail.com': 0.63; 'information': 0.63; 'more': 0.64; 'containing': 0.69; 'received:108': 0.93; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: More general way of generating PyODBC queries as a dict? Date: Tue, 21 May 2013 19:33:18 -0400 Organization: > Bestiaria Support Staff < References: <0f78102c-2e30-4858-ae62-b8d5cecfc345@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-73-118-116.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1369179204 news.xs4all.nl 15961 [2001:888:2000:d::a6]:53611 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45692 On Tue, 21 May 2013 10:27:07 -0700 (PDT), stackoverflowuser95@gmail.com declaimed the following in gmane.comp.python.general: > > For example, when multiple tables are queried; some hackish lambdas are required to generate the resulting dictionary. > > Can you think of some more general methods? > What about using the information from cursor.description You did state PyODBC, did you not? """ description This read-only attribute is a list of 7-item tuples, each containing (name, type_code, display_size, internal_size, precision, scale, null_ok). pyodbc only provides values for name, type_code, internal_size, and null_ok. The other values are set to None. """ -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/