operational errors on insert with Python

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

operational errors on insert with Python

Greg_Miller
I have a Python/wxPython application that inserts data in many places into
various tables in a sqlite database.  All the inserts work fine except for
the latest one:

autoStartcursor.execute('INSERT INTO baseappstart (SerialNumber, Time,
FUSoftwareVersion, GUISoftwareVersion, NexpertVersion, OSISVersion,
SDMSVersion, Login) VALUES ('+serialNum+', '+timetemp+', '+fusBuildVer+',
'+guiVerTemp+', '+nexpertVersion+', '+osisverData+', '+sdmsver+',
'+accessLvl+')')

I have printed out a test string which returns this:

test string is  INSERT INTO baseappstart (SerialNumber, Time,
FUSoftwareVersion, GUISoftwareVersion, NexpertVersion, OSISVersion,
SDMSVersion, Login)
VALUES (1, 1119528625, unknown, 2.5.6, 02.05, 2.5.4, 1.0.0.1, Operator)

as far as I can tell the syntax is correct, when I manually insert it using
Sqlite Analyzer it works fine too.   The error returned is
OperationalError: near ".", syntax error.  When I cut this down to just
sending this:

autoStartcursor.execute("INSERT INTO baseappstart (SerialNumber) VALUES
("+test+")"), with test == 'finally', I get the following error:

OperationalError: no such column: finally

I've reached the end of what I can figure out about this, anyone have any
thoughts, or seen this before??


______________________________________________________________________
 IMPORTANT NOTICE:
The information in this email is confidential and proprietary to NexPress
Solutions, Inc. and may be legally privileged.  It is for the intended
recipient(s) named above only.  Any unauthorized review, printing, copying,

use or distribution of this email by anyone else is prohibited and may be a

criminal offense.  If you have received this email in error, please notify
the
sender immediately by reply email and delete the original message.

Reply | Threaded
Open this post in threaded view
|

Re: operational errors on insert with Python

Hugh Gibson
> The error returned is OperationalError: near ".", syntax error.

Probably because you need to enclose the version strings in single quotes.

> OperationalError: no such column: finally

Use single quotes around values in the SQL. Contents of double quotes are
interpreted as field names.

Hugh
Reply | Threaded
Open this post in threaded view
|

Re: operational errors on insert with Python

Greg_Miller
In reply to this post by Greg_Miller

thank you, that fixed the problem



|---------+--------------------------->
|         |           [hidden email]|
|         |           k (Hugh Gibson) |
|         |                           |
|         |           06/23/2005 09:19|
|         |           AM              |
|         |           Please respond  |
|         |           to sqlite-users |
|         |                           |
|---------+--------------------------->
  >-----------------------------------------------------------------------------------------------------------------|
  |                                                                                                                 |
  |        To:      [hidden email]                                                                         |
  |        cc:                                                                                                      |
  |        Subject: Re: [sqlite] operational errors on insert with Python                                           |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  |                                                                                                                 |
  >-----------------------------------------------------------------------------------------------------------------|




> The error returned is OperationalError: near ".", syntax error.

Probably because you need to enclose the version strings in single quotes.

> OperationalError: no such column: finally

Use single quotes around values in the SQL. Contents of double quotes are
interpreted as field names.

Hugh



______________________________________________________________________
 IMPORTANT NOTICE:
The information in this email is confidential and proprietary to NexPress
Solutions, Inc. and may be legally privileged.  It is for the intended
recipient(s) named above only.  Any unauthorized review, printing, copying,

use or distribution of this email by anyone else is prohibited and may be a

criminal offense.  If you have received this email in error, please notify
the
sender immediately by reply email and delete the original message.