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

Reply via email to