OperationalError: (1054, "Unknown column 'Age' in 'field list'")

I dont understand why I am getting this error ... you can see in the database info section that I  have 'Age' ... Im assuming mysql has some syntax and I'm getting it wrong ... why am I getting this error and why ?


Traceback (most recent call last):
  File "C:\Python26\lib\threading.py", line 532, in __bootstrap_inner
    self.run()
  File "C:\Python26\sign\OCTOBER29_mysqldevlopment.py", line 6880, in run
    cursor.execute("INSERT INTO newtable (Active_Incident_number, Age,Gender,Zip,Ailment,Treatment,Initial_contact,Hospital,Destination,Inservice,Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp) VALUES ( %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s,%s, %s,%s, %s)",(Actual_Incident_number, Age,Gender,Zip,Ailment,Treatment,Initial_contact,Hospital,Destination,Inservice,Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp));
  File "C:\Python26\lib\site-packages\MySQLdb\cursors.py", line 173, in execute
    self.errorhandler(self, exc, value)
  File "C:\Python26\lib\site-packages\MySQLdb\connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'Age' in 'field list'")

Open in new window


Info about my databases and tables

my databases

('transferdb',)

my tables

('newtable',)

 info about table newtable
('Active_Incident_number', 'int(11)', 'YES', '', None, '')
(' Age', 'int(11)', 'YES', '', None, '')
('Gender', 'varchar(20)', 'YES', '', None, '')
('Zip', 'int(11)', 'YES', '', None, '')
('Ailment', 'varchar(20)', 'YES', '', None, '')
('Treatment', 'varchar(20)', 'YES', '', None, '')
('Initial_contact', 'varchar(20)', 'YES', '', None, '')
('Hospital', 'varchar(20)', 'YES', '', None, '')
('Destination', 'varchar(20)', 'YES', '', None, '')
('Inservice', 'varchar(20)', 'YES', '', None, '')
('Sys', 'int(11)', 'YES', '', None, '')
('Dia', 'int(11)', 'YES', '', None, '')
('Pulse', 'int(11)', 'YES', '', None, '')
('Resp', 'int(11)', 'YES', '', None, '')
('Weather', 'varchar(20)', 'YES', '', None, '')
('Temp', 'varchar(20)', 'YES', '', None, '')
('Humid', 'varchar(20)', 'YES', '', None, '')
('Wind', 'varchar(20)', 'YES', '', None, '')
('TimeStamp', 'varchar(20)', 'YES', '', None, '')

Open in new window



#get transferred information
	    conn = lite.connect("PermPatRecord.sqlite")
	    c = conn.cursor()
	    c.execute('select * from ptrecords')
	    for rows in c:
		Actual_Incident_number=+rows[0]		
		Incident_number = rows[1]
		Age= rows[4]
		Gender = rows[5]
		Zip = rows[8]
		Ailment = rows[10]
		Treatment =rows[11]
		Initial_contact= rows[13]
		Hospital = rows[14]
		Inservice= rows[16]
		Destination= rows[15]
		Sys =rows[19]
		Dia=rows[20]
		Pulse=rows[21]
		Resp=rows[22]
		Weather=rows[23]
		Temp=rows[24]
		Humid=rows[25]
		Wind=rows[26]
		TimeStamp=rows[27]
		db = MySQLdb.connect(host="localhost", user="root", passwd="",db="transferdb")
		cursor = db.cursor()
		cursor.execute("INSERT INTO newtable (Active_Incident_number, Age,Gender,Zip,Ailment,Treatment,Initial_contact,Hospital,Destination,Inservice,Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp) VALUES ( %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s, %s, %s,%s,%s, %s,%s, %s)",(Actual_Incident_number, Age,Gender,Zip,Ailment,Treatment,Initial_contact,Hospital,Destination,Inservice,Sys,Dia,Pulse,Resp,Weather, Temp,Humid,Wind,TimeStamp));
		
		db.commit()
		cursor.close()
		db.close()
    
    
		   
	    conn.commit()
	    cur.close()
	    conn.close()

Open in new window

dolamitejenkinsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dave BaldwinFixer of ProblemsCommented:
No, you don't have "Age', you have ' Age' with a space in front of it.  Yes, that does make a difference.
0
dolamitejenkinsAuthor Commented:
Can you answer another question ?

OperationalError: (1366, "Incorrect integer value: '' for column 'Zip' at row 1")

Open in new window

0
Dave BaldwinFixer of ProblemsCommented:
It looks like your "cursor.execute()" statement is trying to put strings into integers or the value for Zip is simply wrong, maybe a letter in it.  Generally speaking, a Zip and Zip+4 fields should be a character or text type because, although it is composed of numbers, it is used as a name and leading zeros need to be preserved.  A numeric field will strip leading zeros.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dolamitejenkinsAuthor Commented:
Thank you so much this is my first go around with mysql server ... I was told it was very similar to sqlite ... not true but I finally got it working .... thanks
0
Dave BaldwinFixer of ProblemsCommented:
You're welcome, glad to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.