If the table already physically exists in the DB,  then you need to make 
sure you have a correct .table file in the yourapp/databases folder.  You 
do this by including the setting "fake_migrate=True" for each table.  Or,  
you may do all tables at once by setting your main DAL connection to 
"fake_migrate_all=True".

Check out the DAL chapter of the book:  www.web2py.com/book

Regards, D

On Monday, 7 May 2012 09:20:41 UTC+1, Rhys wrote:
>
> Hey Guys,
>
> I'm having trouble with DAL, as I already have existing tables in the 
> database. I keep on getting the error: Table exists. How do I get around 
> this so the DAL just accepts that the table is there and creates a new file 
> in the database folder. It seems a bit restrictive when it comes to the 
> database as the db is usually quite morphic as more fields or tables are 
> added as time goes by. Would this be a problem when you start scaling?
>
> I've also put the flag migration=True in the define_table method.  I read 
> the chapter in the book and still it doesn't seem to want to do it. 
>
> If you could give me a scenario on how you would do this with web2py that 
> would be great. So you have a database which is pre-existing and you put in 
> all the define_tables methods for the tables how do use get web2py to do a 
>  if not table exists tablename and then creates the *.table files 
>
> Cheers,
>
> Rhys
>

Reply via email to