[Zope-DB] How to import SQL in python script???

eijgnit@netscape.net eijgnit@netscape.net
Wed, 12 Feb 2003 12:16:17 -0500


Dear all, 

 As a follow up to my earlier question on the above topic. Because the SQLStatement I need to query the database with depends on alot of variables (sometimes I even have to query another relation). I could use sqlgroup and sqltest to do the above.

 But here's another solution, create a ZSQLMethod with only one argument call say "sql", and in the contents just have "<dtml-var sql>". Effectively what this does is to query the database according to what the argument sql is (which of coz must be a valid sql statement). 

So instead of having tons of ZSQLMethod objects with alot of "hard coded" SQL statements, you could instead just use one generic ZSQLMethod that can accept any SQL statements. I think if u need to work with alot of tables and relations, a generic ZSQLMethod is pretty useful. It sure make things a lot easier for me. At least I get to see how my SQL statement is structured before sending it to the DBMS. Now I still need to figure out a easy way to join two relations from two databases. :(


Regards,
Tj









??

__________________________________________________________________
The NEW Netscape 7.0 browser is now available. Upgrade now! http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/