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 Initial Version and Version 1 of SqlObjectDirectSql


Ignore:
Timestamp:
02/13/06 19:19:51 (13 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SqlObjectDirectSql

    v1 v1  
     1Sometimes, you just need the power of real SQL.  If you plan on using SQL, use the sqlmeta to force SQLObject to use your table names and ID names.  This will save you misery in case SQLObject does not use the name that you expect. 
     2 
     3{{{ 
     4class DataTable(SQLObject): 
     5        class sqlmeta: 
     6                table="data_table" 
     7                idName="primary_id" 
     8        miscField= StringCol() 
     9        dtCreated= DateTimeCol( default=datetime.now ) 
     10 
     11        def dict_record_count(self): 
     12                sql = "select count(*) from data_table " 
     13                 
     14                result = self._connection.queryAll(sql) 
     15                return result 
     16}}} 
     17 
     18Note how you pick up the connection from TurboGears.