[web2py] Re: Error on migrate=True

2018-04-07 Thread Anthony
On Saturday, April 7, 2018 at 4:13:16 AM UTC-4, Stephan wrote:
>
> Anthony, 1kTHX, it works now. 
> The error was, that I set *migrate=True* in the DAL connector, i.e.  *db 
> = DAL('credentials.ee@mysql', migrate=True)* but not in the table that 
> was altered.
> So this works for me:
> - I run the application with db = DAL('xxx@xyz', fake_migrate_all=True) 
> - I remove fake_migrate_all=True
> - I add 'migrate=True' to the table where I added al line
>

I'm not sure what your original workflow was, but the "migrate" argument to 
DAL() simply determines the default value of "migrate" in each call to 
.define_table(), both of which default to True -- so explicitly setting 
either of them to True is equivalent to not setting them at all.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Anthony
On Thursday, April 5, 2018 at 5:39:38 PM UTC-4, Stephan wrote:
>
> I got the error afterwards, i.e. I ran fake_migration_all (without errors) 
> and then I altered a table and kicked migrate=true. That's where I ran into 
> the same error as before.
>

*.table files are in the /databases folder. There should be a file for the 
table in question. Hard to say more without seeing your code and what's in 
the /databases folder.

Anthony

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Stephan
I got the error afterwards, i.e. I ran fake_migration_all (without errors) 
and then I altered a table and kicked migrate=true. That's where I ran into 
the same error as before.

Am Donnerstag, 5. April 2018 22:54:16 UTC+2 schrieb Anthony:
>
> Need to see your code. With fake_migrate_all=True, the DAL will generate 
> migration files but no run any migrations, so you cannot get that error.
>
> Anthony
>
> On Thursday, April 5, 2018 at 11:49:38 AM UTC-4, Stephan wrote:
>>
>> Hi Antony, 
>> does not seem to work.
>> I still get an error by setting migrate to true. In which directory are 
>> the *.table file written to? 
>> thx
>>
>>
>>
>>  (1050, "Table 'auth_user' 
>> already exists")Version
>> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>> 9.
>> 10.
>> 11.
>> 12.
>> 13.
>> 14.
>> 15.
>> 16.
>> 17.
>> 18.
>> 19.
>> 20.
>> 21.
>> 22.
>> 23.
>> 24.
>> 25.
>>
>> Traceback (most recent call last):
>>   File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
>> exec ccode in environment
>>   File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
>> ,
>>  line 53, in 
>> auth.define_tables(username=False, signature=False)
>>   File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
>> format='%(first_name)s %(last_name)s (%(id)s)'))
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
>> table = self.lazy_define_table(tablename,*fields,**args)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
>> polymodel=polymodel)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
>> self.create_sequence_and_triggers(query,table)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
>> create_sequence_and_triggers
>> self.execute(query)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
>> return self.log_execute(*a, **b)
>>   File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
>> ret = self.cursor.execute(command, *a[1:], **b)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 
>> 205, in execute
>> self.errorhandler(self, exc, value)
>>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
>> 36, in defaulterrorhandler
>> raise errorclass, errorvalue
>> OperationalError: (1050, "Table 'auth_user' already exists")
>>
>> Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>>>
>>> Probably you don't have *.table files indicating the current status of 
>>> the database schema. First, without the new column in the code, run a 
>>> request with fake_migrate_all=True, which will create an updated set of 
>>> *.table files. Then add the new column, and the migration should work.
>>>
>>> Anthony
>>>
>>> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:

 I am getting an "tables already exist" error after adding column to an 
 existing table in db.py  and setting migrate from false to true. It's 
 connected to a mysql. Application is running in version 2.8.2. Is there 
 some cahce to be cleared? thx

>>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Anthony
Need to see your code. With fake_migrate_all=True, the DAL will generate 
migration files but no run any migrations, so you cannot get that error.

Anthony

On Thursday, April 5, 2018 at 11:49:38 AM UTC-4, Stephan wrote:
>
> Hi Antony, 
> does not seem to work.
> I still get an error by setting migrate to true. In which directory are 
> the *.table file written to? 
> thx
>
>
>
>  (1050, "Table 'auth_user' 
> already exists")Version
> web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback
>
> 1.
> 2.
> 3.
> 4.
> 5.
> 6.
> 7.
> 8.
> 9.
> 10.
> 11.
> 12.
> 13.
> 14.
> 15.
> 16.
> 17.
> 18.
> 19.
> 20.
> 21.
> 22.
> 23.
> 24.
> 25.
>
> Traceback (most recent call last):
>   File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
> exec ccode in environment
>   File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
> ,
>  line 53, in 
> auth.define_tables(username=False, signature=False)
>   File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
> format='%(first_name)s %(last_name)s (%(id)s)'))
>   File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
> table = self.lazy_define_table(tablename,*fields,**args)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
> polymodel=polymodel)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
> self.create_sequence_and_triggers(query,table)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
> create_sequence_and_triggers
> self.execute(query)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
> return self.log_execute(*a, **b)
>   File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
> ret = self.cursor.execute(command, *a[1:], **b)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, 
> in execute
> self.errorhandler(self, exc, value)
>   File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
> 36, in defaulterrorhandler
> raise errorclass, errorvalue
> OperationalError: (1050, "Table 'auth_user' already exists")
>
> Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>>
>> Probably you don't have *.table files indicating the current status of 
>> the database schema. First, without the new column in the code, run a 
>> request with fake_migrate_all=True, which will create an updated set of 
>> *.table files. Then add the new column, and the migration should work.
>>
>> Anthony
>>
>> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:
>>>
>>> I am getting an "tables already exist" error after adding column to an 
>>> existing table in db.py  and setting migrate from false to true. It's 
>>> connected to a mysql. Application is running in version 2.8.2. Is there 
>>> some cahce to be cleared? thx
>>>
>>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-05 Thread Stephan
Hi Antony, 
does not seem to work.
I still get an error by setting migrate to true. In which directory are the 
*.table file written to? 
thx



 (1050, "Table 'auth_user' 
already exists")Version
web2py™ Version 2.8.2-stable+timestamp.2013.11.28.13.54.07Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.

Traceback (most recent call last):
  File "/home/mhoch4/web2py/gluon/restricted.py", line 217, in restricted
exec ccode in environment
  File "/home/mhoch4/web2py/applications/psychogramm/models/db.py" 
,
 line 53, in 
auth.define_tables(username=False, signature=False)
  File "/home/mhoch4/web2py/gluon/tools.py", line 1737, in define_tables
format='%(first_name)s %(last_name)s (%(id)s)'))
  File "/home/mhoch4/web2py/gluon/dal.py", line 8139, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File "/home/mhoch4/web2py/gluon/dal.py", line 8176, in lazy_define_table
polymodel=polymodel)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1058, in create_table
self.create_sequence_and_triggers(query,table)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1899, in 
create_sequence_and_triggers
self.execute(query)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1916, in execute
return self.log_execute(*a, **b)
  File "/home/mhoch4/web2py/gluon/dal.py", line 1910, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/cursors.py", line 205, 
in execute
self.errorhandler(self, exc, value)
  File "/usr/local/lib/python2.7/dist-packages/MySQLdb/connections.py", line 
36, in defaulterrorhandler
raise errorclass, errorvalue
OperationalError: (1050, "Table 'auth_user' already exists")

Am Dienstag, 3. April 2018 21:17:52 UTC+2 schrieb Anthony:
>
> Probably you don't have *.table files indicating the current status of the 
> database schema. First, without the new column in the code, run a request 
> with fake_migrate_all=True, which will create an updated set of *.table 
> files. Then add the new column, and the migration should work.
>
> Anthony
>
> On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:
>>
>> I am getting an "tables already exist" error after adding column to an 
>> existing table in db.py  and setting migrate from false to true. It's 
>> connected to a mysql. Application is running in version 2.8.2. Is there 
>> some cahce to be cleared? thx
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Error on migrate=True

2018-04-03 Thread Anthony
Probably you don't have *.table files indicating the current status of the 
database schema. First, without the new column in the code, run a request 
with fake_migrate_all=True, which will create an updated set of *.table 
files. Then add the new column, and the migration should work.

Anthony

On Tuesday, April 3, 2018 at 12:14:30 PM UTC-4, Stephan wrote:
>
> I am getting an "tables already exist" error after adding column to an 
> existing table in db.py  and setting migrate from false to true. It's 
> connected to a mysql. Application is running in version 2.8.2. Is there 
> some cahce to be cleared? thx
>

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.