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


Groups > comp.lang.python > #39696

Re: Escaping list of numbers for Postgres column names

X-Received by 10.224.110.68 with SMTP id m4mr4065690qap.2.1361644839456; Sat, 23 Feb 2013 10:40:39 -0800 (PST)
X-Received by 10.49.86.40 with SMTP id m8mr488200qez.30.1361644839170; Sat, 23 Feb 2013 10:40:39 -0800 (PST)
Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!t2no4462184qal.0!news-out.google.com!t2ni1102qaj.0!nntp.google.com!t2no4462173qal.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Sat, 23 Feb 2013 10:40:39 -0800 (PST)
In-Reply-To <9f33141f-7cca-4f67-b030-bf16dda778fb@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=86.27.139.172; posting-account=ojw3_QoAAAB4Zzcen71hZ3z681_sEkyv
NNTP-Posting-Host 86.27.139.172
References <9f33141f-7cca-4f67-b030-bf16dda778fb@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <bda02f99-ba2c-4b37-8953-bef1db336650@googlegroups.com> (permalink)
Subject Re: Escaping list of numbers for Postgres column names
From andydtaylor@gmail.com
Injection-Date Sat, 23 Feb 2013 18:40:39 +0000
Content-Type text/plain; charset=ISO-8859-1
X-Received-Bytes 1395
Xref csiph.com comp.lang.python:39696

Show key headers only | View raw


In reply to my own question, postgres column names must begin with a letter or an underscore. So this is what I have done:

>>> for row in cursor_from:
...     if row[8]:
...         stn_list_short.append("_" + row[0])

I can now use stn_list_short to create my columns

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


Thread

Escaping list of numbers for Postgres column names andydtaylor@gmail.com - 2013-02-23 03:55 -0800
  Re: Escaping list of numbers for Postgres column names andydtaylor@gmail.com - 2013-02-23 10:40 -0800

csiph-web