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
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
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
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
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
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:
in 0.db
I have : settings.migrate = True
in db.py I have db.define_table('auth_user', Field (.,Field(), ...
Field...
bla bla bla
.
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
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()
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
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
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
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
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.
14 matches
Mail list logo