>
> hi petr...
>
> wanted to say thanks for your assistance/pointers...


It is good  to know you have sucseeded. :-)

>
> i managed to create a quick test that illustrates a method of using a
> string "id" for a tbl, as opposed to the "auto generated" int that is
> normally required.
>
> i'm including the sample sql that i used to create the test database
> (mysql) as well as the short chunk of test python to implement the string
> 'id' for the table...
>
> It is good to know you solved your task. The only thing I do not
understand is why do you create tables using SQL commands. Thanks to the
great work of the people around SQLobjects it just a piece of cake to create
your any table using SQLobject:

t1 = 'mysql://lab:[EMAIL PROTECTED]/jfrank3'
sqlhub.processConnection = connectionForURI(t1)

class Foo(SQLObject):
       class sqlmeta:
               table = 'test'
               idName='id'
               idType=str
       aa =StringCol(length=5)
       id2 =StringCol(length=20)

Foo.createTable(ifNotExists=True)

Anyway, I have found for testing purposes it is great to use "in memory
database". It means table (tables) are created in memory only, not on the
disk. Using this scenario you don't need to dig through the "URI string"
syntax at beginning. You need just following two lines of code and you can
write your code.

from sqlobject import *
sqlhub.processConnection = connectionForURI('sqlite:/:memory:')

And if you do not need to update/insert the data and store them back to the
database, I mean if you need just to "present" some subpart of it, you can
find this technique fairly useful.

Petr Jakes
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to