2009/11/10 Wolfgang Morawetz <wolfgang.morawetz@gmx.at>
Petr Jakeš schrieb:
>
>     Maybe you can printout the names SQLObject reads from the database
>     and than use this names:
>     for col in TCountry.sqlmeta.columnList:
>         print col
>
> Or maybe:
>
> print col.origName, col.dbName
>
> Petr
>
Hmmm,
for TAthlet i get:
TUnionID TUnion_id
short short
name name
TGenderID TGender_id
TGroupID TGroup_id
TCountryID TCountry_id

and for TCountry:
name name

So SQLObject removes the underline ok, but i get no id fields?

BTW Thanks for helping Petr!

You can define (name) existing columns (names) explicitly. Even existing ID column. I am using existing database as well and I am connecting to it this way:

class Cenktgm01(SQLObject):
#    _connection = connection
    class sqlmeta:       
        idType = str
        idName = 'OID$CENKTGM01'
    ktgi = StringCol(dbName="ktginterni")

BTW, you do not need to know about the id. SQLObject is treating id automatically beneath the scene.

Sometime wiki can help: http://wiki.sqlobject.org/
I am experimenting with the SQLite inMemory database a lot as well (as shown in following exampe).

from sqlobject import *
connectionInMemory = connectionForURI('sqlite:/:memory:')
class Person(SQLObject):
    _connection = connectionInMemory
    firstName = StringCol()
    middleInitial = StringCol(length=1, default=None)
    lastName = StringCol()

Regards

Petr

PS: please try to "reply to all", so other peeople in the mailing list can help/comment as well.