Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-20 Thread Niphlod
if you use 'reference tablename' replace all your 'defined' with 'created yet on the database' and all you sentence is right. On Saturday, October 20, 2012 2:41:52 AM UTC+2, Don_X wrote: Definitely clearer ! ... Thanks a bunch guys ! ... in conclusion : whenever one decides to do the

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-19 Thread Le Don X
Definitely clearer ! ... Thanks a bunch guys ! ... in conclusion : whenever one decides to do the conditional model approach for performance concerns or else ... database tables better be defined first ! even more so if there are reference fields in the tables involved! in which case a table

[web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
hello web2py users, I am looking for specifics when it comes to creating additional tables within a sub-directory of MODELS ! I am making significant progress on my app ! and I know that I will certainly have an overhead issue because in my db.py file I have about 20 tables defined and some

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
New feature lazy_table doesn't help? I would go with lazy_table before use sub-directory since if you use sub-directory depending of your app design your code will be less DRY. You need to have the same function in controller sub-directory for each table. So if all your table use the same

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
Richard .. at this stage ! ... the controller file for each sub directory table files are not the issue ... for now ... the tables are not getting created at all ! ... what I did to start fresh 1) i delete the database files in the database directory 2) delete the session files in the session

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
I don't understand you last sentence... Even if you move your db into sub folder the need to be defined with db.table_define(...)?! Also, maybe you just had set migrate_enabled=False in your db connection string?? Richard On Thu, Oct 18, 2012 at 11:22 AM, Don_X don.clerm...@gmail.com wrote:

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
in 0.db I have : settings.migrate = True in db.py I have db.define_table('auth_user', Field (.,Field(), ... Field... bla bla bla .

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Marin Pranjić
On Thu, Oct 18, 2012 at 4:20 PM, Don_X don.clerm...@gmail.com wrote: hello web2py users, I get the error : class '_mysql_exceptions.OperationalError' (1005, Can't create table ...bla bla bla .. It's hard to say without any code but from your error, I guess problem is with foreign

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
Let me try to keep it simple .. because I don't want to pollute this thread with many tables and fields OK ... initially everything was working OK ! I had 3 models files like the followings : 0.py, db.py menu.py in 0.dy I had : from gluon.storage import Storage settings = Storage()

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Marin Pranjić
If MySQL reports an error number 1005 from a CREATE TABLE statement, and the error message refers to error 150, table creation failed because a foreign key constraint was not correctly formed. Similarly, if an ALTER TABLE fails and it refers to error 150, that means a foreign key

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Niphlod
Let's make it one step futher in being explicit in explanations. There are no much specifics to discuss about conditional models because it's easy to understand the flow logic. assuming you have controllers/default.py controllers/test.py controllers/foo.py controllers/bar.py models/db.py

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
Thank you gentlemen for your input ! Niphlod .. i understood the flow logic from the start .. even before I tried it, that is why I tried it ! ... what kept my attention is the response above yours ! The flow logic was easy to comprehend ! ... but : It seems From Marin's answer, the tables

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
I think you just need to make sure that each model you refer get defined before it get refer. Since web2py parse model files in alphanumeric you have to make sure the model file that contain your table definition is at the right place. I am not sure how web2py parse the sub-folder, it may parse

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Niphlod
so you were missing the table logic creation. There are two methods: db.define_table('test1', Field('foo') ) db.define_table('test2', Field('bar', db.test1) ) or db.define_table('test2', Field('bar', 'reference test1') ) So. 1st method needs db.test1 defined in the environment.