Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of SQLObjectReservedWords


Ignore:
Timestamp:
04/22/06 10:27:57 (13 years ago)
Author:
tlesher@…
Comment:

Added example using sqlmeta

Legend:

Unmodified
Added
Removed
Modified
  • SQLObjectReservedWords

    v1 v2  
    1 When naming classes for you model, using reserved words such as "Group" or "Order" will cause an SQL syntax error during table creation.   
     1When naming classes for you model, using names that are reserved words in SQL, such as "Group" or "Order", will cause an SQL syntax error during table creation.   
    22 
    33Reserved words that commonly cause errors: 
     
    66 * Option 
    77 
     8To avoid this, you can either use a prefix (like TG_Group in the TurboGears identity framework), or else use an "sqlmeta" inner class in your model object: 
     9 
     10{{{ 
     11#!python 
     12class Group(SQLObject): 
     13    class sqlmeta: 
     14        table=app_group 
     15}}} 
     16 
     17This way, your model object's name can still be (for example) "Group", but the table name SQLObject uses will be "app_group". 
     18 
    819More information:  
    920 * Mailing list: [http://groups.google.com/group/turbogears/browse_thread/thread/0f6ff19c6e933bef/c7ea323bb006cc08 do NOT use Group or Order as SQLObject classes]