473,491 Members | 2,636 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

MySQL Error #1064 in Python Programming

cpiyush
31 New Member
Hello,

I am trying to insert values in a MySQL table using Python as front end, but facing this problem.

table structure:-(Name:- namespace)
Fields
prifex-----------------varchar(20)
namespace--------varchar(100)

Code:-
Expand|Select|Wrap|Line Numbers
  1.     global prefix_dict
  2.     global dbConn
  3.  
  4.     keys=[]
  5.     i=0
  6.     prefix=''
  7.     nmspace=''
  8.  
  9.     keys=prefix_dict.keys()
  10.  
  11.     while i<len(keys):
  12.         prefix=keys[i]
  13.         nmspace=prefix_dict[keys[i]]
  14.         s="""("""+str(prefix)+""","""+str(nmspace)+""")"""
  15.         print "--------------------------------------------"
  16.         print s
  17.         print "--------------------------------------------"
  18.         s1="""INSERT INTO namespace VALUES"""+s
  19.         print s1
  20.         dbConn.query(s1)
  21.                                 i+=1
  22.  
Output:-

--------------------------------------------
(default,<http://Demo:Remo@172.21.107.145:8080/SfleXProd/#>)
--------------------------------------------
Expand|Select|Wrap|Line Numbers
  1. INSERT INTO namespace VALUES(default,<http://Demo:Remo@172.21.107.145:8080/SfleXProd/#>)
  2.     dbConn.query(s1)
_mysql_exceptions.ProgrammingError: (1064, "You have an error in your SQL syntax
; check the manual that corresponds to your MySQL server version for the right s
yntax to use near '<http://Demo:Remo@172.21.107.145:8080/SfleXProd/#>)' at line
1")


Problem:-
I am using variable names instead of literal values in the insert statement & not getting the correct syntax, although when I am using literal values i am getting the success.

plz help me that how to use variable names in insert query.
Jan 25 '07 #1
1 4799
bartonc
6,596 Recognized Expert Expert
Hello,

Problem:-
I am using variable names instead of literal values in the insert statement & not getting the correct syntax, although when I am using literal values i am getting the success.

plz help me that how to use variable names in insert query.
I do that all the time. See this thread.
Jan 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2404
by: Paul M | last post by:
I encountered the following error when trying to perform a SQL UPDATE to a MySQL database table from Python. I would apprciate any assistance. In the Python code I have tried integer and decimal...
0
4543
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with...
0
654
by: Morten Gulbrandsen | last post by:
Hi programmers, I try to investigate some of the basics behind schemas and cataloges, Which is part of SQL2 Language this is the error message I get:
0
2958
by: Kenneth Illingsworth | last post by:
--=_603E7359.5B3A569C Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I suspect that this is some kind of issue with...
0
4978
by: Fatt Shin | last post by:
Hi, I'm running MySQL 4.0.13, connecting from PowerBuilder 9 using ODCB Connector 3.51. I'm facing a problem where whenever I issue a SELECT COUNT(*) statement from PowerBuilder, I always get SQL...
0
2341
by: Mario Ohnewald | last post by:
Hello! I want to import a MySQL 3.x Databse to my new shiny MySQL4.x. I did a backup with /usr/local/mysql-standard-4.0.14-pc-linux-i686/bin/mysqldump -u root -p --opt -A > mysql_lamp_backup.`date...
4
5813
by: Adam Smith | last post by:
I have a dedicated server running 'FreeBSD 4.9 STABLE' at a hosting site. They have done some default installations, presumably from the CVS ports package ??. Herein lies the problem, "I do not...
3
2295
by: Thiagu.M | last post by:
Hi All i dont have much experience in databases or Mysql.i have my data in development m/c with Mysql 4.1.12, i have to move them to production m/c with Mysql 5.0.3 .when tried it showed error...
39
5823
by: alex | last post by:
I've converted a latin1 database I have to utf8. The process has been: # mysqldump -u root -p --default-character-set=latin1 -c --insert-ignore --skip-set-charset mydb mydb.sql # iconv -f...
0
7183
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6852
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7356
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5448
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3084
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3074
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1389
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
277
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.