a lot has changed with mapper initialization (and plenty of bugs....), but not tables. can you send a test example ?
heres a session with tables: >>> from sqlalchemy import * >>> meta = MetaData() >>> t = Table('sometable', meta, Column('col1', Integer, primary_key=True), Column ('col2', Integer)) >>> t.c.keys() ['col1', 'col2'] >>> t.c['col1'] Column('col1',<sqlalchemy.types.Integer object at 0x7a14d0>,key='col1',primary_key=True,nullable=False,hidden=False,defaul t=None,onupdate=None) the "c" attribute seems to be OK with mappers too tho: >>> mapper(Foo, t) <sqlalchemy.orm.mapper.Mapper object at 0x10e48d0> >>> Foo.c.col1 Column('col1',<sqlalchemy.types.Integer object at 0x7a14d0>,key='col1',primary_key=True,nullable=False,hidden=False,defaul t=None,onupdate=None) >>> class_mapper(Foo).mapped_table Table('sometable', MetaData(), Column('col1',<sqlalchemy.types.Integer object at 0x7a14d0>,key='col1',primary_key=True,nullable=False,hidden=False,defaul t=None,onupdate=None), Column('col2',<sqlalchemy.types.Integer object at 0x7a1c30>,key='col2',primary_key=False,nullable=True,hidden=False,defaul t=None,onupdate=None), schema=None) >>> On Jun 22, 2006, at 9:40 PM, Brad Clements wrote: > I have code that's been working with an earlier version of 0.2 > > after svn up tonight I find this odd behaviour, that is table.c is > busted until the first > query is executed. Then that table starts working, but other tables > are broken too > until I perform a select on them. > > Revision: 1654 > > -- > > > I'm using sqlalchemy w/ python2.4 on windows with paste > > table.c.keys() returns an empty list AND > > this code fails on when building up the query (that is, table.c[k] > raises an error) > (for example, k='id') > > args = [] > if criteria: > for k, v in criteria.items(): > args.append(table.c[k] == v) > > # if there's no criteria or whatever, so they > # want everything. Need an extra arg to > # allow dumping everything > if args or form.get('selectall'): > records = table.select(*args) > > > However if I execute a query without any criteria first, THEN > table.c.keys() works > and table.c['id'] works > > ---- > > to clarify > > 1. start up paste app > > 2. try table.c['id'] == '1' and I get this exception: > > File 'E:\\prj\\src\\eclipse\\parent_to_parent\\Web\\p2pserver\ > \p2pserver\\dbaccess.py', line 66 in __call__ > args.append(table.c[k] == v) > File 'e:\\prj\\src\\sqlalchemy\\lib\\sqlalchemy\\util.py', line 114 > in __getitem__ > return self.__data[key] > File 'e:\\prj\\src\\sqlalchemy\\lib\\sqlalchemy\\util.py', line 174 > in __getitem__ > return dict.__getitem__(self, key) > exceptions.KeyError: 'id' > > > 3. or table.c.keys() returns [] > > 4. then try table.select(*[]) that returns all rows in the table ok > > 5. and now table.c.keys() returns the columns and table.c['id'] works > > 6. try another table, and it's also broken until a select is > performed. > > > > > -- > Brad Clements, [EMAIL PROTECTED] (315)268-1000 > http://www.murkworks.com > AOL-IM or SKYPE: BKClements > > > > Using Tomcat but need to do more? Need to support web services, > security? > Get stuff done quickly with pre-integrated technology to make your > job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache > Geronimo > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sqlalchemy-users mailing list > Sqlalchemy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Sqlalchemy-users mailing list Sqlalchemy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users