Thanks Echo,
Will check it out.
Something else you may be able to answer:
I noticed trying to create "temporary" SQLite tables that it wrote to
the current directory.
Can you specify memory resident SQLite tables?
Regards
Mark Doukidis
On 8/17/06, Echo <[EMAIL PROTECTED]> wrote:
On 8/16/06, Mark Doukidis <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to create tables on the fly and populate them via
> dAutoBizobj.initTable.
>
> I cannot figure why this message is produced:
> --------------------------------------------------------------------
> Traceback (most recent call last):
> File "testapp.py", line 32, in ?
> main()
> File "testapp.py", line 29, in main
> dabo.biz.autoCreateTables()
> File "c:\dabo\dabo\dabo\biz\dAutoBizobj.py", line 47, in autoCreateTables
> biz.CreateTable()
> File "c:\dabo\dabo\dabo\biz\dAutoBizobj.py", line 283, in CreateTable
> self.new()
> File "c:\dabo\dabo\dabo\biz\dBizobj.py", line 615, in new
> self._onNew()
> File "c:\dabo\dabo\dabo\biz\dBizobj.py", line 941, in _onNew
> cursor.setDefaults(self.DefaultValues)
> File "c:\dabo\dabo\dabo\db\dCursorMixin.py", line 1124, in setDefaults
> raise ValueError, "Can't set default value for nonexistent field '%s'." %
kk
> ValueError: Can't set default value for nonexistent field 'owing'.
> --------------------------------------------------------------------
> from this code:
> --------------------------------------------------------------------
> import dabo
> from dabo.db import dTable
> import dabo.biz.dAutoBizobj as autobiz
>
> def main():
> class Customer(autobiz):
>
> def initProperties(self):
> self.DataSource = "customer"
> self.KeyField = "id"
> self.RequeryOnLoad = False
>
> def getTable(self):
> tab = dTable(Name="customer", IsTemp=False)
> tab.addField(Name="id", IsPK=True, DataType="int", Size=2,
> IsAutoIncrement=True)
> tab.addField(Name="code", DataType="int", Size=4,
> AllowNulls=False, Index="idx_code")
> tab.addField(Name="name", DataType="string", Size=50,
> Index="idx_name")
> tab.addField(Name="contact", DataType="string", Size=15)
> tab.addField(Name="owing", DataType="float", TotalDP=8,
> RightDP=2, Size=8, Default=0)
> return tab
>
> def initTable(self):
> cols = ('code','name','contact','owing')
> return (cols, ((1,"Ken's Kayaks","Ken",100.55),(2,"Bob's
> Bikes","Bob",234.56)))
>
> ci = dabo.db.dConnectInfo(DbType="SQLite", Database="test.db")
> conn = dabo.db.dConnection(ci)
> dabo.biz.setupAutoBiz(conn, (Customer,))
> dabo.biz.autoCreateTables()
>
> if __name__ == "__main__":
> main()
> --------------------------------------------------------------------
>
> Any pointers welcome.
>
> Mark Doukidis
Cool, that didn't take as long as I though it would. I just commited
the fix for it.
PS. I'm glad I'm not the only one using the autoBizobj feature.
--
"Now that I am a Christian I do not have moods in which the whole
thing looks very improbable: but when I was an atheist I had moods in
which Christianity looked terribly probable."
-C. S. Lewis
-Echo
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users