[Zope-DB] Dynamically generate sql-query in ZSQL Method

Charlie Clark charlie at egenix.com
Wed Apr 7 14:43:28 EDT 2004

Dear Adam,

the quickest way to get you started is #1 in my e-mail yesterday - it will 
work with all ZopeDA's.

1) the standard Zope approach
  from Products.ZSELMethods.SQL import SQL
  methodId = 'sqlListEmployees'
  setattr(self, methodId, SQL(methodId, '', 'employeesDB', 'Select * FROM   
  result =self.sqlListEmployees()

The setattr() method calls a connection and allows you to create dynamic 
SQL. If you have another call before this which returns the fields in 
question then you should have everything you need.

Please come back with a more specific question if you're still having 


On 2004-04-07 at 18:28:28 [+0200], hawelek_tlen wrote:
> Hi,
> at first I want to thank for each help,
> my problem is that I have to use something dynamic to generate SQL-query, 
> because I have one table with fields, in which are sql-quries,
> so first I take this query from one table and than I execute it,
> I know that maybe it is a little bit strange,
> but this is my Task:),
> maybe someone know how can I do this in the best way,
Charlie Clark

Professional Python Services directly from the Source
 >>> Python/Zope Consulting and Support ...        http://www.egenix.com/
 >>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
 >>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::

More information about the Zope-DB mailing list