[Zope-DB] HELP. What is the best way to call a ZSQL method from an External Python method ?

Pavel V. Piankov pashah@cosmos-mebel.spb.ru
Mon, 24 Dec 2001 09:58:27 +0300

> I have this problem, I have an External Python method that needs to open a
ZSQL method passing to it some

try this in your ExMeth:

def sqlGetter(self, q):
  database = getattr(self, 'Put here your DB connection id')
  res = database().query(q)
  return res

later do smth like this

q = 'select * from data where datepart(mm,wdate) = %s and datepart(yy,wdate)
= %s' % (m, y)
data = self.sqlGetter(q)

as usual: yr milage may vary (:
Pavel V. Piankov <pashah@cosmos-mebel.spb.ru>
CIO @ Cosmos-Mebel, JSC. http://www.cosmos-mebel.spb.ru
phone|fax: +(7 812) 446.49.16, 447.51.13, 446.47.73. mobile:931.57.37