Can you please post the entire mode? My guess is an issue with capitalization perhaps combined with corruption of table files.
On Tuesday, 7 August 2012 06:00:06 UTC-5, Aurelijus Useckas wrote: > > I've tried nearly any possible syntax, but with no success. Any line with > the reference to other table causes an error 1005 / 150: > "table creation failed because a foreign key constraint was not correctly > formed" > Wasted a lot of time on it with no avail, guess will be forced to go back > to ol' SQLite :) > > On Wednesday, August 1, 2012 8:03:05 PM UTC+3, Massimo Di Pierro wrote: >> >> Try >> >> Field('City', 'list:reference City', label='Miestas'), >> >> On Wednesday, 1 August 2012 11:05:02 UTC-5, Aurelijus Useckas wrote: >>> >>> tried it, still the same error :( thnx anyway >>> >>> On Wednesday, August 1, 2012 6:31:52 PM UTC+3, Massimo Di Pierro wrote: >>>> >>>> Yes. this is wrong: >>>> >>>> Field('City', db.city, 'list:reference city', label='Miestas'), >>>> >>>> should be >>>> >>>> Field('City', 'list:reference city', label='Miestas'), >>>> >>>> On Wednesday, 1 August 2012 09:15:07 UTC-5, Aurelijus Useckas wrote: >>>>> >>>>> Thank you Massimo, but the 1005/150 mysql problem seems to be smth >>>>> wring with foreign key (merging of tables). Are there any flaws in my DAL >>>>> syntax? >>>>> >>>>> This line seems to be the trigger: >>>>> Field('City', db.city, 'list:reference city', label='Miestas'), >>>>> >>>>> it references: >>>>> >>>>> db.define_table('city', >>>>> Field('name', notnull=True, unique=True), >>>>> format='%(name)s') >>>>> >>>>> any ideas what's bothering mysql? >>>>> >>>>> >>>>> On Wednesday, August 1, 2012 4:56:03 PM UTC+3, Massimo Di Pierro wrote: >>>>>> >>>>>> db = DAL('mysql://....', check_reserved=['common','mysql']) >>>>>> >>>>>> Anyway, I am not sure your problem is that you are using a reserved >>>>>> keyword. Perhaps the table exists already. I am also surprised you are >>>>>> getting a pymysql InternalError and not an OperationalError. >>>>>> >>>>>> On Wednesday, 1 August 2012 07:45:01 UTC-5, Aurelijus Useckas wrote: >>>>>>> >>>>>>> I've changed the long into longitude and it seems to be solved but I >>>>>>> still get errors: >>>>>>> >>>>>>> p2 >>>>>>> S'<class \'gluon.contrib.pymysql.err.InternalError\'> (1005, >>>>>>> u"Can\'t create table \'./lpkdb/asoc.frm\' (errno: 150)")' >>>>>>> >>>>>>> Now it says it cannot create next table, which is: >>>>>>> >>>>>>> db.define_table('asoc', >>>>>>> Field('name', label='Pavadinimas', unique=True), >>>>>>> Field('City', db.city, 'list:reference city', label='Miestas'), >>>>>>> Field('address', label='Adresas'), >>>>>>> Field('www'), >>>>>>> Field('tel'), >>>>>>> Field('fax'), >>>>>>> Field('email'), >>>>>>> Field('President', label='Asociacijos prezidentas'), >>>>>>> Field('CEO', label='Asociacijos generalinis'), >>>>>>> Field('CEO_tel', label='Generalinio tel.'), >>>>>>> Field('CEO_email', label='Generalinio email'), >>>>>>> Field('CEO_mob', label='Generalinio mobilus'), >>>>>>> Field('Pres_tel', label='Prezidento tel.'), >>>>>>> Field('Pres_email', label='Prezidento email'), >>>>>>> Field('Pres_mob', label='Prezidento mobilus'), >>>>>>> Field('submited_at', 'datetime', default=request.now, >>>>>>> writable=False, readable=False), >>>>>>> Field('updated_at', 'datetime', default=request.now, >>>>>>> update=request.now, writable=False, readable=False), >>>>>>> Field('submited_by', db.auth_user, default=auth.user_id, >>>>>>> writable=False, readable=False), >>>>>>> Field('updated_by', db.auth_user, update=auth.user_id, >>>>>>> writable=False, readable=False), >>>>>>> format='%(name)s') >>>>>>> >>>>>>> Are there some guidlines on how to construct DAL field names in >>>>>>> order to avoid any conflict while migrating to mysql? >>>>>>> >>>>>>> >>>>>>> On Wednesday, August 1, 2012 3:36:51 PM UTC+3, tomasz bandura wrote: >>>>>>>> >>>>>>>> Is it 'long' a mysql's reserved word? >>>>>>>> >>>>>>>> Regards >>>>>>>> Tomasz >>>>>>>> >>>>>>>> 2012/8/1 Aurelijus Useckas <aurelijus.usec...@gmail.com> >>>>>>>> >>>>>>>>> this is the trigger i guess: >>>>>>>>> >>>>>>>>> db.define_table('maps', >>>>>>>>> Field('name'), >>>>>>>>> Field('last_name'), >>>>>>>>> Field('long'), >>>>>>>>> Field('lat'), >>>>>>>>> format='%(name)s') >>>>>>>>> >>>>>>>>> On Wednesday, August 1, 2012 3:30:40 PM UTC+3, Aurelijus Useckas >>>>>>>>> wrote: >>>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> I've built the app on SQLite and now want to migrate to the >>>>>>>>>> server based mysql. BUT web2py hangs in the middle of creating, >>>>>>>>>> basicaly >>>>>>>>>> just after the auth tables. When I restart the apache I can see auth >>>>>>>>>> tables >>>>>>>>>> as well as a few from my app. >>>>>>>>>> >>>>>>>>>> this is the err ticket that I get: >>>>>>>>>> >>>>>>>>>> (dp1 >>>>>>>>>> S'output' >>>>>>>>>> p2 >>>>>>>>>> S'<class \'gluon.contrib.pymysql.err.**ProgrammingError\'> >>>>>>>>>> (1064, u"You have an error in your SQL syntax; check the manual that >>>>>>>>>> corresponds to your MySQL server version for the right syntax to use >>>>>>>>>> near >>>>>>>>>> \'long VARCHAR(255),\\n lat VARCHAR(255),\\n PRIMARY >>>>>>>>>> KEY(id)\\n) >>>>>>>>>> ENGINE=InnoDB CHA\' at line 5")' >>>>>>>>>> p3 >>>>>>>>>> sS'layer' >>>>>>>>>> p4 >>>>>>>>>> S'/opt/web-apps/web2py/**applications/init/models/db_**comp.py' >>>>>>>>>> p5 >>>>>>>>>> sS'code' >>>>>>>>>> p6 >>>>>>>>>> >>>>>>>>>> thnx >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> --