[Zope] Problem with DTML and JOINS(ZSQL)
Dear all, I am developing a web application for a biological research institute down here in india. I have some problem in using JOINS. The below is the queries i used, *SQL query **File name : drug* select drug_name,dtype from bio_info_schema.drug order by dtype *File name:drug_gene_details* Note : i used both the sql queries seperately, but neither one worked. SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name FROM drug,drug_gene WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=dtml-sqlvar drug_name type=string SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name FROM drug INNER JOIN drug_gene ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=dtml-sqlvar drug_name type=string Below is the DTML code i have used, *File name : view_drug_detail* table width = 30% border = 1 tr !-- Table header -- thDrug Name/th /tr !-- Iterate through drug details using dtml-in tag -- dtml-in drug !-- for each drug , print out the drug name and type of drug -- tr td align = center a href=http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/* drug_gene_details*/drug_name/dtml-var drug_name/*view_drug_info*dtml-var drug_name/a/td /tr /dtml-in /table *File name : view_drug_info* h3font color= #008000centerDrug Information Summary/center/font/h3 table width = 100% border = 1 align=center tr thDrug name/thtddtml-var drug_name/td /tr tr thRoute of Administration/thtddtml-var route_of_admin/td /tr tr thDosage (Adult)/thtddtml-var dose_adult/td /tr tr thDosage (Child)/thtddtml-var dose_child/td /tr tr thAdverse Effects/thtddtml-var adverse_effects/td /tr tr thDrug Type/thtddtml-var dtype/td /tr tr thDrug Targets/thtddtml-var gene_name/td /tr /table This is the error which i got. Site Error An error was encountered while publishing this resource. exceptions.KeyError Sorry, a site error occurred. Traceback (innermost last): * Module ZPublisher.Publish, line 150, in publish_module * Module ZPublisher.Publish, line 114, in publish * Module Zope, line 134, in zpublisher_exception_hook * Module Shared.DC.ZRDB.DA, line 547, in __getattr__ KeyError: _r Troubleshooting Suggestions * The URL may be incorrect. * The parameters passed to this resource may be incorrect. * A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Any kind of suggestion and help will be very useful. Thanks in advance. -- Best Regards \madhan Things must be learned only to be unlearned again or, more likely, to be corrected. -- Richard Feynman ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with DTML and JOINS(ZSQL)
Did you try the Test tab at ZSQL method management page? If it does not work, you will get error from SQL server. If it works and you does not get any data, then your query is not fit to any data. - Original Message - From: member madhangc To: zope@zope.org Sent: Tuesday, April 15, 2008 1:08 PM Subject: [Zope] Problem with DTML and JOINS(ZSQL) Dear all, I am developing a web application for a biological research institute down here in india. I have some problem in using JOINS. The below is the queries i used, SQL query File name : drug select drug_name,dtype from bio_info_schema.drug order by dtype File name:drug_gene_details Note : i used both the sql queries seperately, but neither one worked. SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name FROM drug,drug_gene WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=dtml-sqlvar drug_name type=string SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name FROM drug INNER JOIN drug_gene ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=dtml-sqlvar drug_name type=string ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Problem with DTML and JOINS(ZSQL)
Zope is agnostic of whatever SQL you enter. In other words, they compile differently and their errors are completely different. I suggest you do this: 1. Fake the ZSQL to make sure your DTML is correct by changing the SQL to something like this: SELECT 'drug_name_test', 'route_of_admin_test', etc. 2. Then write the ZSQL properly with the correct SQL syntax that you want to use and as you're developing this, test it using the ZSQL Method's Test tab rather than testing it via your custom DTML application. 3. Run together. PS. Tip: I always name my ZSQL methods something like select_all_drug_zsql or UpdateOneDrug.sql just to avoid confusion when I'm later working on the application. 'drug' isn't a suitable name of a function/method. On 15/04/2008, member madhangc [EMAIL PROTECTED] wrote: Dear all, I am developing a web application for a biological research institute down here in india. I have some problem in using JOINS. The below is the queries i used, SQL query File name : drug select drug_name,dtype from bio_info_schema.drug order by dtype File name:drug_gene_details Note : i used both the sql queries seperately, but neither one worked. SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug_gene.gene_name FROM drug,drug_gene WHERE drug.drug_name = drug_gene.drug_name and drug.drug_name=dtml-sqlvar drug_name type=string SELECT drug.drug_name,drug.route_of_admin,drug.dose_adult,drug.dose_child,drug.adverse_effects,drug.dtype,drug_gene.gene_name FROM drug INNER JOIN drug_gene ON drug.drug_name = drug_gene.drug_name AND drug.drug_name=dtml-sqlvar drug_name type=string Below is the DTML code i have used, File name : view_drug_detail table width = 30% border = 1 tr !-- Table header -- thDrug Name/th /tr !-- Iterate through drug details using dtml-in tag -- dtml-in drug !-- for each drug , print out the drug name and type of drug -- tr td align = center a href=http://localhost:8080/ddrd/ddrtb/drugs/display_drugs/drug_gene_details/drug_name/dtml-var drug_name/view_drug_infodtml-var drug_name/a/td /tr /dtml-in /table File name : view_drug_info h3font color= #008000centerDrug Information Summary/center/font/h3 table width = 100% border = 1 align=center tr thDrug name/thtddtml-var drug_name/td /tr tr thRoute of Administration/thtddtml-var route_of_admin/td /tr tr thDosage (Adult)/thtddtml-var dose_adult/td /tr tr thDosage (Child)/thtddtml-var dose_child/td /tr tr thAdverse Effects/thtddtml-var adverse_effects/td /tr tr thDrug Type/thtddtml-var dtype/td /tr tr thDrug Targets/thtddtml-var gene_name/td /tr /table This is the error which i got. Site Error An error was encountered while publishing this resource. exceptions.KeyError Sorry, a site error occurred. Traceback (innermost last): * Module ZPublisher.Publish, line 150, in publish_module * Module ZPublisher.Publish, line 114, in publish * Module Zope, line 134, in zpublisher_exception_hook * Module Shared.DC.ZRDB.DA, line 547, in __getattr__ KeyError: _r Troubleshooting Suggestions * The URL may be incorrect. * The parameters passed to this resource may be incorrect. * A resource that this resource relies on may be encountering an error. For more detailed information about the error, please refer to the HTML source for this page. If the error persists please contact the site maintainer. Thank you for your patience. Any kind of suggestion and help will be very useful. Thanks in advance. -- Best Regards \madhan Things must be learned only to be unlearned again or, more likely, to be corrected. -- Richard Feynman ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev ) -- Peter Bengtsson, work www.fry-it.com home www.peterbe.com hobby www.issuetrackerproduct.com ___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )