Well, my case is a bit different. I'm writing a nightly running batch
script. And this script is not running inside pyramid context, which means
it is not the model that called from the framework. Instead, I arrange it
to run by system cron. But, I'm trying to utilize the pyramid environment
On Dec 1, 2011, at 4:29 PM, Geo wrote:
And I was suspecting it is the reason of the complex joins in usage, because
I have other code that doing things in the same way,
the structure of the Query/ SELECT statement that gets you back some data has
no connection on how that data behaves
Ok I found the solution, just move the first query into the transaction
body:
import transaction
try:
transaction.begin()
x_members = session.query(Distributor)...
for member in x_members:
.
except:
transaction.abort()
BTW, I'm using pyramid framework, which is using the
I have a query to join another two querys which are written as
subqueries:
paid_120_count = session.query(Capital_invest.member_id,
func.count().label(count)).\
join(Product,
Capital_invest.prod_id==Product.prodid).\
On Nov 27, 2011, at 1:15 AM, Geo wrote:
I have a query to join another two querys which are written as
subqueries:
paid_120_count = session.query(Capital_invest.member_id,
func.count().label(count)).\
join(Product,
Capital_invest.prod_id==Product.prodid).\