Cool

I learnt a lot from this thread.

I used to delete "everything" from both DB as well as 
applications/myapp/databases folder
I think later contains *.table files. I didn't know that I can remove 
individual *.table files. 
Also did not know about fake_migration. Gotta try it sometime.

In production setup - I have migrate=False. I *always* create/alter tables 
manually in MySQL.
I use the definitions for alter/create from 
applications/myapp/databases/sql.log file

-Mandar

On Thursday, July 17, 2014 12:12:12 PM UTC+5:30, Massimo Di Pierro wrote:
>
> Hello Austin,
>
> I apologize I have overlooked your message and I would like to help with 
> the problem. There seem to be thre distinct problems:
> 1) In your original post the "web2py_session_runstone.table" was there but 
> the database had no knowledge of the table. This can only happen if the 
> table is manually removed from the database. That is fine but if you remove 
> it, that you have to remove the corresponding .table file. 
> 2) In you second post you mention the "functions can't be picked" error. 
> That is an application level error. You are storing a function in a session 
> object.
> 3) In response to niphlod's answer you deleted all your .table files while 
> you were supposed to delete only the web2py_session_runstone.table file 
> corresponding to the missing table.
>
> At this point it is hard for us to figure out which tables are in the 
> database and which are in the .table files and if they are in sync since 
> you deleted the files that contain that information. It is possible to 
> rebuild everything that requires a little bit of trial and error. The 
> easiest solution may be to disable fake_migrations, zap the db, and remove 
> all the .table files again. web2py will rebuild all your tables (assuming 
> no errors in your code).
>
> If there are errors in your code (function in session) the transaction 
> will abort. Mind that there is a problem with MySQL that is not related to 
> web2py. MySQL requires that each create table be its own transaction 
> (postgresql instead allows running all create tables in one transaction). 
> That means that if there is an error in your code (for example a table name 
> with an invalid name) your code will fail and you may end up with a partial 
> transaction. Some tables will be created and some no.
>
> Again this is not a web2py problem. This is a MySQL problem. My Advice is 
> the following: try create the table with sqlite first. This will tell you 
> that everything is working fine with the application. Once it works, then 
> switch to MySQL.
>
> Alternatively, if you are comfortable with SQL, disable migrations 
> completely and create the table in DB yourself manually. This is what you 
> would with other frameworks anyway.
>
> I hope this helps.
>
> Massimo
>
>
> On Thursday, 3 July 2014 10:28:23 UTC-5, Austin Bart wrote:
>>
>> Ah, apologies. I was a little over-enthusiastic with my deletions.
>>
>> So I did fake_migrate_all=True, let web2py create the tables, and then 
>> turned off fake_migrations. However, web2py did not create a 
>> web2py_session_runestone table file. All the other tables are there, just 
>> no web2py_session_runestone.table. The sql.log file doesn't refer to it at 
>> all.
>>
>> ~Cory
>>
>> On Thursday, July 3, 2014 11:06:59 AM UTC-4, Niphlod wrote:
>>>
>>> who said "delete everything" ? :P
>>>
>>> now, do a fake_migrate_all=True, let web2py recreate table files, then 
>>> turn off fake_migrations, then delete ONLY webp2y_session_runestone and 
>>> retry.
>>>
>>> Simone
>>>
>>> On Thursday, July 3, 2014 11:30:35 AM UTC+2, Austin Bart wrote:
>>>>
>>>> Migrations should be on. I have it enabled through my DAL:
>>>> db = DAL(settings.database_uri, migrate_enabled=True)
>>>> And through each individual table:
>>>> db.define_table('courses', ... migrate='runestone_courses.table')
>>>> I've emptied the entire databases/ folder of all the .table files.
>>>>
>>>> This seems to have made the situation worst, since now I can't read 
>>>> error tickets - clicking the link opens a new ticket. I've tried getting 
>>>> into my application's errors/ files, and I see that this line is still 
>>>> in there:
>>>> Table \'runestone_dev.web2py_session_runestone\' doesn\'t exist
>>>> The latest error in the admin application's errors/ folder has this 
>>>> line:
>>>> can't pickle function objects
>>>>
>>>> ~Cory
>>>>
>>>> On Thursday, July 3, 2014 4:37:22 AM UTC-4, Niphlod wrote:
>>>>>
>>>>> did you turn migrations on ?
>>>>> if yes, please check that there isn't a 
>>>>> *web2py_session_runestone*.table file into the database/ folder. If there 
>>>>> is, delete it and web2py will recreate it.
>>>>>
>>>>> On Thursday, July 3, 2014 1:44:38 AM UTC+2, Austin Bart wrote:
>>>>>>
>>>>>> Recently after some updates to some of my models, I got this error in 
>>>>>> web2py.
>>>>>>
>>>>>> Traceback (most recent call last):
>>>>>>   File "/Users/acbart/web2py/gluon/main.py", line 457, in wsgibase
>>>>>>     session._try_store_in_db(request, response)
>>>>>>   File "/Users/acbart/web2py/gluon/globals.py", line 1116, in 
>>>>>> _try_store_in_db
>>>>>>     record_id = table.insert(**dd)
>>>>>>   File "/Users/acbart/web2py/gluon/dal.py", line 9114, in insert
>>>>>>     ret =  self._db._adapter.insert(self, self._listify(fields))
>>>>>>   File "/Users/acbart/web2py/gluon/dal.py", line 1360, in insert
>>>>>>     raise eProgrammingError: (1146, u"Table 
>>>>>> 'runestone_dev.web2py_session_runestone' doesn't exist")
>>>>>>
>>>>>> My web2py application is named runestone, and the database is named 
>>>>>> runestone_dev. I've checked the MySQL database and the table doesn't 
>>>>>> exist. But it is my understanding that this is a table that should be 
>>>>>> automatically generated for me. Anyone know what gives? It doesn't 
>>>>>> appear 
>>>>>> to be a problem with my code...
>>>>>>
>>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to