Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103111

Re: pymysql question

Path csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From MRAB <python@mrabarnett.plus.com>
Newsgroups comp.lang.python
Subject Re: pymysql question
Date Thu, 18 Feb 2016 12:52:32 +0000
Lines 20
Message-ID <mailman.247.1455799968.22075.python-list@python.org> (permalink)
References <0b27ecb5-4a3e-46dc-a83c-5ce806f46051@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de FK2EvVcmJ4B6R+c/gyKiKwUKJxHOh34HlYKI9M+F5a3Q==
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'column': 0.07; 'subject:question': 0.08; 'dict': 0.09; 'rows': 0.09; 'python': 0.10; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'lowercase': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'mixture': 0.16; 'names?': 0.16; 'received:192.168.1.4': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'row': 0.16; 'wrote:': 0.16; 'names.': 0.22; 'tables': 0.23; 'this:': 0.23; 'header:In-Reply-To:1': 0.24; 'header:User-Agent:1': 0.26; 'actual': 0.28; 'query': 0.30; 'table': 0.32; 'received:84': 0.32; 'could': 0.35; 'according': 0.36; 'possible': 0.36; 'to:addr:python-list': 0.36; 'subject:: ': 0.37; 'doing': 0.38; 'names': 0.38; 'skip:p 20': 0.38; 'received:192': 0.39; 'build': 0.40; 'to:addr:python.org': 0.40; 'field': 0.60; 'email addr:gmail.com': 0.62; 'upper': 0.76
X-CM-Score 0.00
X-CNFS-Analysis v=2.1 cv=Iat6Ijea c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=IkcTkHD0fZMA:10 a=pGLkceISAAAA:8 a=uPZiAMpXAAAA:8 a=IuLMYpc61Hzpa_-XNcwA:9 a=QEXdDO2ut3YA:10 a=kKlv5diQZ1kA:10
X-AUTH mrabarnett@:2500
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1
In-Reply-To <0b27ecb5-4a3e-46dc-a83c-5ce806f46051@googlegroups.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21rc2
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:103111

Show key headers only | View raw


On 2016-02-18 12:08, tdsperth@gmail.com wrote:
> Hi All
>
> I have many mysql tables in a conversion I am doing - the table field names are a mixture of lower case and upper case - do I have to covert all to one case to over come Python not finding the field.
>
> rows ocur.fetchall()
> for row in rows:
>      print(row['newname'])
>      #which fails because it is upper case in the table
>
According to this:

MySQL query to get column names?
http://stackoverflow.com/questions/4165195/mysql-query-to-get-column-names

it's possible to get the column names.

You could then build a dict to map a lowercase column name to an actual 
column name.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

pymysql question tdsperth@gmail.com - 2016-02-18 04:08 -0800
  Re: pymysql question MRAB <python@mrabarnett.plus.com> - 2016-02-18 12:52 +0000
  Re: pymysql question Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-18 22:06 -0500

csiph-web