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

Version 1 (modified by anonymous, 9 years ago) (diff)

--

Sometimes, 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.

class DataTable(SQLObject):
	class sqlmeta:
		table="data_table"
		idName="primary_id"
	miscField= StringCol()
	dtCreated= DateTimeCol( default=datetime.now )

	def dict_record_count(self):
		sql = "select count(*) from data_table "
		
		result = self._connection.queryAll(sql)
		return result

Note how you pick up the connection from TurboGears.