Hi all
I have a need to execute native SQL query in pylons controller and my
model is Elixir based
After some hours of research I found following solution
con = g.sa_engine.connect()
try:
result = g.sa_engine.connect().execute(text("""select
c.id, count (p.*) from product p, product_category c
where p.category_id = c.id
and p.status = :status
group by c.id"""),
status=model.Product.STATUS_ON_DISPLAY).fetchall()
finally:
con.close()
print (result)
I have a questions about this solution:
- Is it the proper way of doing such things?
- should I close connection explicitly or it will be closed
implicitly? (after 10 calls there were no increase of idle
connections)
Thanks in advance for answers
Mykola
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---