[web2py] Re: Different applications usiong same set of tables

2014-01-08 Thread Niphlod


On Wednesday, January 8, 2014 5:37:12 AM UTC+1, Jayadevan M wrote:
>
> Thank you. So fake_migrate=True will scan the structure defined for tables 
> defined under models in the .py files and create files under databases so 
> that the structure defined in the python files and in the databases folder 
> are same. It wil not really connect to the database at all.
>

it will connect, but it won't issue any DDL statement (change in structure 
of the underlying db). Also, one run of fake_migrate=True is enough, it's 
not meant to be left on.   
 

> If we set migrate=false, web2py will not do any checks at all, but 
> 'assume' that the database table structure is in synch with those defined 
> under the models, and issue a ticket if there are issues.
> The files under database folder have no significance if migrate=False.
>
>
Yep, and that's why in production you **should** always set migrate=False: 
web2py won't have to "diff" models and .table files to see if there are any 
DDL statements to issue over and over.  

-- 
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/groups/opt_out.


[web2py] Re: Different applications usiong same set of tables

2014-01-07 Thread Jayadevan M
Thank you. So fake_migrate=True will scan the structure defined for tables 
defined under models in the .py files and create files under databases so 
that the structure defined in the python files and in the databases folder 
are same. It wil not really connect to the database at all. 
If we set migrate=false, web2py will not do any checks at all, but 'assume' 
that the database table structure is in synch with those defined under the 
models, and issue a ticket if there are issues.
The files under database folder have no significance if migrate=False.
On Wednesday, January 8, 2014 2:18:59 AM UTC+5:30, Niphlod wrote:
>
> migrate=False prevents web2py to check if the underlying tables are in 
> sync with your model.
> you don't need to run fake_migrate=True if you're not planning on altering 
> tables on app2.
> fake_migrate=True just generates .table files according to your model, so 
> you'll get (assuming the connection string is identical) exactly the same 
> files that you can find under app1/databases/
>
> On Tuesday, January 7, 2014 12:44:10 PM UTC+1, Jayadevan M wrote:
>>
>> I have an application app1. I want to create another application - app2 
>> which will use the same set of tables as used by app1. For this, what I 
>> have to do is create a tables.py under app2/models and mention 
>> migrate=False for the common tables. Is that right? Do I have to set 
>> fake_migrate=True and ensure the table files are created under databases 
>> folder in app2? My simple tests tell me it is not necessary. Just for 
>> confirmation.
>>
>

-- 
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/groups/opt_out.


[web2py] Re: Different applications usiong same set of tables

2014-01-07 Thread Anthony
You can also define models in a module function or class and import into 
both apps (e.g., the way Auth works). There is also 
http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Using-DAL-without-define-tables,
 
though you don't get the web2py specific attributes, such as validators, 
widgets, etc.

Anthony

On Tuesday, January 7, 2014 6:44:10 AM UTC-5, Jayadevan M wrote:
>
> I have an application app1. I want to create another application - app2 
> which will use the same set of tables as used by app1. For this, what I 
> have to do is create a tables.py under app2/models and mention 
> migrate=False for the common tables. Is that right? Do I have to set 
> fake_migrate=True and ensure the table files are created under databases 
> folder in app2? My simple tests tell me it is not necessary. Just for 
> confirmation.
>

-- 
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/groups/opt_out.


[web2py] Re: Different applications usiong same set of tables

2014-01-07 Thread Niphlod
migrate=False prevents web2py to check if the underlying tables are in sync 
with your model.
you don't need to run fake_migrate=True if you're not planning on altering 
tables on app2.
fake_migrate=True just generates .table files according to your model, so 
you'll get (assuming the connection string is identical) exactly the same 
files that you can find under app1/databases/

On Tuesday, January 7, 2014 12:44:10 PM UTC+1, Jayadevan M wrote:
>
> I have an application app1. I want to create another application - app2 
> which will use the same set of tables as used by app1. For this, what I 
> have to do is create a tables.py under app2/models and mention 
> migrate=False for the common tables. Is that right? Do I have to set 
> fake_migrate=True and ensure the table files are created under databases 
> folder in app2? My simple tests tell me it is not necessary. Just for 
> confirmation.
>

-- 
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/groups/opt_out.