Re: [SQLObject] SqlObject Sqlmeta fromDatabase problem
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Petr J. <pet...@tp...> - 2012-03-27 07:13:25
|
> fromDatabase: A boolean (default false). If true, then on class creation > the database will be queried for the table's columns, and any missing > columns (possible all columns) will be added automatically. > I started with these > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > > Added > class Company(SQLObject): > class sqlmeta: > fromDatabase = True > lazyUpdate = False > cacheValues = True > Company_Name = StringCol(length = 256, default = None) > Company_Address = StringCol(length = 256, default = None) > Company_Phone = StringCol(length = 256, default = None) > *Company_Number = StringCol(length = 256, default = None)* > > class Companys(): > def __init__(self): > Company.createTable(ifNotExists = True, connection=conn) > > > Hi Jeremy, what about the Naming Style? see: Changing the Naming Style <http://sqlobject.org/SQLObject.html#id56> .... By default names in SQLObject are expected to be mixed case in Python (like mixedCase), and underscore-separated in SQL (like mixed_case). This applies to table and column names. Regards Petr |