Re: Select does not work with some fieldname
Petr Jakeš <petr.jakes <at> tpc.cz>
2009-11-10 12:30:26 GMT
2009/11/10 Wolfgang Morawetz
<wolfgang.morawetz <at> 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.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss