[SQLObject] creating tables at run time
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: maxwell h. <no...@ms...> - 2004-02-16 11:36:52
|
Not sure if this is safe but this is what works
from SQLObject import *
import new
import copy
conn = MySQLConnection(user='test',db='test')
class TMessageBoard(SQLObject):
_connection=conn
user_name=StringCol()
boardname=StringCol()
parent=IntCol()
joinColumn="MessageLists"
def _getcolumns(self):
return [c.kw['name'] for c in self._columns]
_getcolumns = classmethod(_getcolumns)
t = new.classobj(
'fredy',
(TMessageBoard,),
{
})
print dir(t)
print t
t.createTable(True)
and i end up with a table named fredy
_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8.
http://join.msn.com/?page=dept/bcomm&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
|