Thanks for clarifying it.
So that, to speed up web2py, we must use migrate_enabled=False instead of
migrate=False at DAL definition. Otherwise for all the auth_* tables,
web2py will access the disk to verify if the relative file in
databases/hash_tablename.table exists and is updated, right?
If what I have said is correct I would suggest to update the book,
http://web2py.com/books/default/chapter/29/13#Efficiency-tricks
changing migrate=False with migrate_enabled=False

Paolo


2013/1/15 Anthony <[email protected]>

> DAL(..., migrate=False) does not completely turn off migrations but merely
> sets the default migrate value for each table to False if it is not set
> explicitly. The auth.define_tables() method, however, explicitly sets
> migrate to True for each Auth table unless otherwise specified, so you
> would have to do auth.define_tables(..., migrate=False). Another option is
> to completely disable all migrations, regardless of individual table
> settings, via:
>
> DAL(..., migrate_enabled=False)
>
> Anthony
>
>
> On Tuesday, January 15, 2013 7:35:14 AM UTC-5, Paolo valleri wrote:
>>
>> is on the db definition.
>> db = DAL('postgres://web2py:web2py@**localhost:5432/traffic',
>>  migrate=False,
>> lazy_tables=True,
>> )
>>
>> Paolo
>>
>> On Tuesday, January 15, 2013 11:38:49 AM UTC+1, Niphlod wrote:
>>>
>>> migrate=False is on the db or on Auth define_table() call ?
>>>
>>>
>>>
>>> Il giorno martedì 15 gennaio 2013 11:07:49 UTC+1, Paolo valleri ha
>>> scritto:
>>>>
>>>> Hi all, I tried something odd.
>>>> I pulled a fresh copy of my code from git and I connected the app to an
>>>> already 'working' database. 'working' in the meaning that both tables and
>>>> data are already in the database. In web2py this approach fails, because at
>>>> the first run it tries to create all the tables, and the db raises an
>>>> exception like 'table already exist'.
>>>> In order to fix that I thought that migrate=False would help, however
>>>> it fails again. due to Auth that tries to create the tables. Ticket:
>>>>
>>>> Traceback (most recent call last):
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/restricted.py", line 212, in 
>>>> restricted
>>>>
>>>>     exec ccode in environment
>>>>
>>>>   File 
>>>> "/home/pvalleri/src/web2py/**applications/vtraffic/**controllers/default.py"
>>>>  
>>>> <http://127.0.0.1:8000/admin/default/edit/vtraffic/controllers/default.py>,
>>>>  line 6, in <module>
>>>>
>>>>     start = db.record.with_alias('start_**point')
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7221, in 
>>>> __getattr__
>>>>
>>>>     return self.lazy_define_table(tablena**me,*fields,**args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7174, in 
>>>> lazy_define_table
>>>>
>>>>     table = table_class(self, tablename, *fields, **args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7594, in __init__
>>>>
>>>>     field.requires = sqlhtml_validators(field)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 6338, in 
>>>> sqlhtml_validators
>>>>
>>>>     referenced = db[field_type[10:]]
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7215, in 
>>>> __getitem__
>>>>
>>>>     return self.__getattr__(str(key))
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7221, in 
>>>> __getattr__
>>>>
>>>>     return self.lazy_define_table(tablena**me,*fields,**args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7177, in 
>>>> lazy_define_table
>>>>
>>>>     table._create_references() # must follow above line to handle self 
>>>> references
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7663, in 
>>>> _create_references
>>>>
>>>>     rtable = db[rtablename]
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7215, in 
>>>> __getitem__
>>>>
>>>>     return self.__getattr__(str(key))
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7221, in 
>>>> __getattr__
>>>>
>>>>     return self.lazy_define_table(tablena**me,*fields,**args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 7189, in 
>>>> lazy_define_table
>>>>
>>>>     polymodel=polymodel)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 935, in 
>>>> create_table
>>>>
>>>>     self.create_sequence_and_**triggers(query,table)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 2483, in 
>>>> create_sequence_and_triggers
>>>>
>>>>     self.execute(query)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 1709, in execute
>>>>
>>>>     return self.log_execute(*a, **b)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/dal.py", line 1703, in 
>>>> log_execute
>>>>
>>>>     ret = self.cursor.execute(*a, **b)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/dbapi.py"**, line 
>>>> 246, in _fn
>>>>
>>>>     return fn(self, *args, **kwargs)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/dbapi.py"**, line 
>>>> 317, in execute
>>>>
>>>>     self._execute(operation, args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/dbapi.py"**, line 
>>>> 322, in _execute
>>>>
>>>>     self.cursor.execute(new_query, *new_args)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/**interface.py", 
>>>> line 399, in execute
>>>>
>>>>     self._stmt.execute(*args, **kwargs)
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/**interface.py", 
>>>> line 169, in execute
>>>>
>>>>     self._row_desc, cmd = self.c.bind(self._portal_name, 
>>>> self._statement_name, args, self._parse_row_desc, kwargs.get("stream"))
>>>>
>>>>   File "/home/pvalleri/src/web2py/**gluon/contrib/pg8000/protocol.**py", 
>>>> line 943, in _fn
>>>>
>>>>     return fn(self, *args<span style="color: #660;" class="styled-by...
>>>> Mostra originale 
>>>> <https://groups.google.com/group/web2py/msg/64de6b8ababbd2a3?dmode=source&output=gplain&noredirect>
>>>>
>>>>  --
>
>
>
>



-- 
 Paolo

-- 



Reply via email to