On May 26, 4:15 am, Neveen Adel <[email protected]> wrote:
> Hello,
>
>  i have a problem in the creation of new database
>
> I wrote my design into db.py :
>
> and then i run my application the tables was created only in
> "appadmin", but when i show tables into mysql it displayed an empty
> set.
>
> then any update in the tables it cause
> "
> ProgrammingError: (1146, "Table 'MLD.user' doesn't exist")
> "

Did you make a db connection to your mysql database in your models?
(see example connection strings at 
http://www.web2py.com/book/default/section/6/2)
If you used the default database connection, then with appadmin you
would have created
an sqlite database for you.

>
> so any one have any idea what is the problem?
>
> The second issue :
>
> i have a table and i want to make a relation to itself?
>
> as :
>
> db.define_table("location_unit)",
... looks like a typo; this should be:
  db.define_table("location_unit",
>       SQLField("name", "string", notnull=True),
>       SQLField("parentLocation", db.location_unit),

...use Field in favor of SQLField  (but either works);  this should
be:

       Field("parentLocation", "reference location_unit"),

see http://www.web2py.com/book/default/section/6/13 for more
information.

Regards,
- Yarko
>       )
> it cause "
>     return dict.__getitem__(self,key)
>      KeyError: 'location_unit'
> "
>
> Please could any one help me ??
>
> Thanks

Reply via email to