0.2 is not released yet and is still under construction; 0.1.7 is more stable (but both are still officially alpha....).

On May 17, 2006, at 7:49 PM, Yuan HOng wrote:

I have the following very simple program with SA0.2, which just
changes a field of a selected object and flushes it back to the
database:

import sqlalchemy.mods.threadlocal
from sqlalchemy import *

meta = BoundMetaData('postgres://postgres:[EMAIL PROTECTED]/test', echo=True)

class Brand(object):  pass
t_brands = Table('brands', meta, autoload=True)
Brand.mapper = mapper(Brand, t_brands)

brands = Brand.mapper.select()
brands[1].brand_name = 'BrandNew'
objectstore.flush()

Running the program gives the following output:

...
[2006-05-18 07:43:37,858] [engine]: {}
[2006-05-18 07:43:37,890] [engine]: BEGIN
[2006-05-18 07:43:37,905] [engine]: UPDATE brands SET
brand_name=%(brand_name)s WHERE brands.brand_id = %(brands_brand_id)s
[2006-05-18 07:43:37,921] [engine]: {'brand_name': 'BrandNew',
'brands_brand_id': 2}
[2006-05-18 07:43:37,953] [engine]: COMMIT
Traceback (most recent call last):
 File "simple_test.py", line 15, in ?
   objectstore.flush()
File "d:\Python24\lib\site-packages\sqlalchemy-0.1.6-py2.4.egg \sqlalchemy\orm\session.py",
line 233, in flush
   self.uow.flush(self, objects, echo=self.echo_uow)
File "d:\Python24\lib\site-packages\sqlalchemy-0.1.6-py2.4.egg \sqlalchemy\orm\unitofwork.py",
line 243, in flush
   trans.rollback()
File "d:\Python24\lib\site-packages\sqlalchemy-0.1.6-py2.4.egg \sqlalchemy\orm\session.py",
line 55, in rollback
   t[1].rollback()
File "d:\Python24\lib\site-packages\sqlalchemy-0.1.6-py2.4.egg \sqlalchemy\engine\threadlocal.py",
line 12, in rollback
   base.Transaction.rollback(self)
File "d:\Python24\lib\site-packages\sqlalchemy-0.1.6-py2.4.egg \sqlalchemy\engine\base.py",
line 340, in rollback
raise exceptions.InvalidRequestError("This transaction is inactive") sqlalchemy.exceptions.InvalidRequestError: This transaction is inactive

What could be wrong? By the way, is the main functions described in
SA0.2 documentation fully implemented? For example, the function
current_session doesn't seem to exist.

I am trying to switch to SA as my ORM for a production system. Shall I
start with SA0.17 or directly with SA0.2?

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn
-------------------------------------------------------
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&kid0709&bid&3057&dat1642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to