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


Groups > comp.lang.python > #36540

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

Date 2013-01-10 01:11 +0000
From MRAB <python@mrabarnett.plus.com>
Subject Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database
References <b1c7ea47-47b4-4784-8037-e0856fdaa7cd@googlegroups.com> <kcl0p4$ssr$1@reader1.panix.com> <bd7fc6c9-a1d0-4bb0-91cc-435eda94154e@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.352.1357780318.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 2013-01-10 00:19, andydtaylor@gmail.com wrote:
> Hi John,
>
> He're the code I would like to see work. The cursor_to is an oversight. I extracted this element from some other code in an attempt to isolate/resolve the problem myself, hence having a simplified table version. Which works actually, but unfortunately that's not educating me suffieciently. Actual error message I see follows.
>
[snip]

> - - - - - - - - - - - - - - - - - - - - - - - - -
> Error Message:
>
> andyt@andyt-ThinkPad-X61:~/projects/django-stringer/Other/TFLJPAPI$ python creat_db_exp.py
>    File "creat_db_exp.py", line 15
>      cursor.execute("INSERT INTO tubecross (station_code, SAJ, SPB, SOQ) VALUES (%s, %s, %s, %s)",(SAJ, 00:00, 00:22, 00:27))
>                                                                                                           ^
> SyntaxError: invalid syntax
>
"00:00", etc, aren't valid Python, they're two ints with a colon
between them.

You need to determine what Python class to use to represent those.

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


Thread

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 15:52 -0800
  Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database John Gordon <gordon@panix.com> - 2013-01-10 00:08 +0000
    Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 16:19 -0800
      Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database Mitya Sirenef <msirenef@lightbird.net> - 2013-01-09 20:07 -0500
      Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database MRAB <python@mrabarnett.plus.com> - 2013-01-10 01:11 +0000
        Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 18:20 -0800
          Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database Mitya Sirenef <msirenef@lightbird.net> - 2013-01-09 21:56 -0500
        Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database andydtaylor@gmail.com - 2013-01-09 18:20 -0800
  How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 07:01 +0100
  Re: [Tutor] How to run multiline shell command within python Hugo Arts <hugo.yoshi@gmail.com> - 2013-01-10 09:31 +0100
  Re: [Tutor] How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 15:25 +0100
  Re: [Tutor] How to run multiline shell command within python Matty Sarro <msarro@gmail.com> - 2013-01-10 10:21 -0500
  Re: [Tutor] How to run multiline shell command within python Karim <kliateni@gmail.com> - 2013-01-10 20:07 +0100

csiph-web