mysql - I cannot assign a primary key or a foreign key in mysqldb, with python. -


i using mysqldb in python, , cannot create table primary or foreign key. can create table, since following works:

theconn = mdb.connect('localhost', 'root', 'pw', 'db') thedb = theconn.cursor(); thedb.execute("create table hf_aum_returns ( \     fundid int not null , \     metric_type char(10) , \     metric_value float , \     datetime date )") 

however, when run following line:

thedb.execute("create table hf_aum_returns_2 ( \     fundid int not null , \     metric_type char(10) , \     metric_value float , \     datetime date , \     constraint returns_pk primary key ( fundid , metric_type , metric_value , datetime )") 

i error telling me check syntax:

_mysql_exceptions.programmingerror: (1064,  "you have error in sql syntax;  check manual corresponds  mysql server version right syntax use near '' @ line 1") 

ugh. not bright. missed parenthesis, @ end of statement. (...been staring @ hour...)


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -