PostgreSQL Problem
Hello, I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have created the following ZSQL method (here displayed in the "Test"-View): Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu Idmenushow Idwebseite Menuitem 54 25 Description 57 110 Components 61 71 Objectives 52 20 Links 51 57 About us SQL used: SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ; I try to use the output of this Query in the following DTML-document: DTML Document at /Control_Panel/Products/Ifsg/Databasetest <dtml-var standard_html_header> <dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer> If I try to "View" Databasetest I get: Zope Error Zope has encountered an error while publishing this resource. Error Type: KeyError Error Value: Menuitem Could anybody enlighten me, what´s the problem here? Kind regards Andreas.
On Tue, 13 Mar 2001, Andreas Tille wrote:
SQL used:
SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ;
I try to use the output of this Query in the following DTML-document:
DTML Document at /Control_Panel/Products/Ifsg/Databasetest
<dtml-var standard_html_header>
<dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer>
If I try to "View" Databasetest I get:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: Menuitem
But what is the Menuitem? There is no such thing in the result of your SQL query. Oleg. ---- Oleg Broytmann http://www.zope.org/Members/phd/ phd@phd.pp.ru Programmers don't die, they just GOSUB without RETURN.
Hello, I failed to use zope-pygresqlda as described in the mail before. According to a hint I fiedled around with capitalisation of the database field MenuItem but nothing helped. I wonder if I should give psycopg a try. Formerly I had serious problems when trying to install Popy so I see new light on the horizon now. Seems to be a little bit hard for a beginner like me to get PostgreSQL connection working. Unfortunately I missed the URL where I can obtain psycopg in the thread named "best postgreSQL adapter?". Can somebody give me a link? Kind regards Andreas. For the record of my previous problem: On Tue, 13 Mar 2001, Andreas Tille wrote:
Hello,
I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have created the following ZSQL method (here displayed in the "Test"-View):
Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu
Idmenushow Idwebseite Menuitem 54 25 Description 57 110 Components 61 71 Objectives 52 20 Links 51 57 About us
SQL used:
SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ;
I try to use the output of this Query in the following DTML-document:
DTML Document at /Control_Panel/Products/Ifsg/Databasetest
<dtml-var standard_html_header>
<dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer>
If I try to "View" Databasetest I get:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: Menuitem
The pyscopg homepage is here: http://initd.org http://initd.org/Software/psycopg Regards Paolo Comitini pcm@initd.org On Wednesday 14 March 2001 11:45, Andreas Tille wrote:
Hello,
I failed to use zope-pygresqlda as described in the mail before. According to a hint I fiedled around with capitalisation of the database field MenuItem but nothing helped. I wonder if I should give psycopg a try. Formerly I had serious problems when trying to install Popy so I see new light on the horizon now. Seems to be a little bit hard for a beginner like me to get PostgreSQL connection working.
Unfortunately I missed the URL where I can obtain psycopg in the thread named "best postgreSQL adapter?". Can somebody give me a link?
Kind regards
Andreas.
For the record of my previous problem:
On Tue, 13 Mar 2001, Andreas Tille wrote:
Hello,
I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have created the following ZSQL method (here displayed in the "Test"-View):
Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu
Idmenushow Idwebseite Menuitem 54 25 Description 57 110 Components 61 71 Objectives 52 20 Links 51 57 About us
SQL used:
SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ;
I try to use the output of this Query in the following DTML-document:
DTML Document at /Control_Panel/Products/Ifsg/Databasetest
<dtml-var standard_html_header>
<dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer>
If I try to "View" Databasetest I get:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: Menuitem
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Paolo Comitini paolo.comitini@mixadlive.com Mixad Live s.r.l. http://www.mixadlive.com tel +39-0125-669020, fax +39-0125-668984 via della Cartiera 2 10010 - Parella (TO) Italy
Hello, I really wonder how to do debugging in Zope. I tried several things regarding to the available documentation and because I've got no answer over this list I think there is no problem in the code I posted (see below). Are there any methods to track down the problem? I know that many people use PostgreSQL with Zope but I wonder how they got their very first example working :-(. Kind regards Andreas. On Tue, 13 Mar 2001, Andreas Tille wrote:
Hello,
I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have created the following ZSQL method (here displayed in the "Test"-View):
Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu
Idmenushow Idwebseite Menuitem 54 25 Description 57 110 Components 61 71 Objectives 52 20 Links 51 57 About us
SQL used:
SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ;
I try to use the output of this Query in the following DTML-document:
DTML Document at /Control_Panel/Products/Ifsg/Databasetest
<dtml-var standard_html_header>
<dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer>
If I try to "View" Databasetest I get:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: Menuitem
Could anybody enlighten me, what's the problem here?
Kind regards
Andreas.
Hi Andreas, Hmm... have you tried: <dtml-var i.MenuItem> which is what shows up in your select statement? the upper/lower caseness of these things also matters. -steve
"Andreas" == Andreas Tille <tillea@rki.de> writes:
Andreas> Hello, Andreas> I really wonder how to do debugging in Zope. I tried Andreas> several things regarding to the available documentation Andreas> and because I've got no answer over this list I think Andreas> there is no problem in the code I posted (see below). Andreas> Are there any methods to track down the problem? I know Andreas> that many people use PostgreSQL with Zope but I wonder Andreas> how they got their very first example working :-(. Andreas> Kind regards Andreas> Andreas. Andreas> On Tue, 13 Mar 2001, Andreas Tille wrote: >> Hello, >> >> I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have >> created the following ZSQL method (here displayed in the >> "Test"-View): >> >> Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu >> >> Idmenushow Idwebseite Menuitem 54 25 Description 57 110 >> Components 61 71 Objectives 52 20 Links 51 57 About us >> >> >> SQL used: >> >> SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER >> JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 >> ORDER BY i.Sort ; >> >> >> I try to use the output of this Query in the following >> DTML-document: >> >> DTML Document at /Control_Panel/Products/Ifsg/Databasetest >> >> >> <dtml-var standard_html_header> >> >> >> <dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> >> <dtml-var standard_html_footer> >> >> >> If I try to "View" Databasetest I get: >> >> Zope Error >> >> Zope has encountered an error while publishing this resource. >> >> Error Type: KeyError Error Value: Menuitem >> >> Could anybody enlighten me, what's the problem here? >> >> Kind regards >> >> Andreas. Andreas> _______________________________________________ Zope Andreas> maillist - Zope@zope.org Andreas> http://lists.zope.org/mailman/listinfo/zope ** No cross Andreas> posts or HTML encoding! ** (Related lists - Andreas> http://lists.zope.org/mailman/listinfo/zope-announce Andreas> http://lists.zope.org/mailman/listinfo/zope-dev )
Hi (again) Andreas, you might also try just: <dtml-var MenuItem> I don't remember if ZSQL will strip off the tablename or not. I do know that due to the fact that result objects use a dictionary to hold results you can't have two tables with fields of the same name, but you can use 'AS' to fix that. select a.count AS a_count, b.count AS b_count from .... to give 'count' a distinct name in the result object.. good luck! -steve
"SJS" == Steve Spicklemire <steve@spvi.com> writes:
SJS> Hi Andreas, SJS> Hmm... have you tried: SJS> <dtml-var i.MenuItem> SJS> which is what shows up in your select statement? SJS> the upper/lower caseness of these things also matters. SJS> -steve
"Andreas" == Andreas Tille <tillea@rki.de> writes:
Andreas> Hello, Andreas> I really wonder how to do debugging in Zope. I tried Andreas> several things regarding to the available documentation Andreas> and because I've got no answer over this list I think Andreas> there is no problem in the code I posted (see below). Andreas> Are there any methods to track down the problem? I know Andreas> that many people use PostgreSQL with Zope but I wonder Andreas> how they got their very first example working :-(. Andreas> Kind regards Andreas> Andreas. Andreas> On Tue, 13 Mar 2001, Andreas Tille wrote: >>> Hello, >>> >>> I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have >>> created the following ZSQL method (here displayed in the >>> "Test"-View): >>> >>> Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu >>> >>> Idmenushow Idwebseite Menuitem 54 25 Description 57 110 >>> Components 61 71 Objectives 52 20 Links 51 57 About us >>> >>> >>> SQL used: >>> >>> SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m >>> INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = >>> 52 ORDER BY i.Sort ; >>> >>> >>> I try to use the output of this Query in the following >>> DTML-document: >>> >>> DTML Document at /Control_Panel/Products/Ifsg/Databasetest >>> >>> >>> <dtml-var standard_html_header> >>> >>> >>> <dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> >>> <dtml-var standard_html_footer> >>> >>> >>> If I try to "View" Databasetest I get: >>> >>> Zope Error >>> >>> Zope has encountered an error while publishing this resource. >>> >>> Error Type: KeyError Error Value: Menuitem >>> >>> Could anybody enlighten me, what's the problem here? >>> >>> Kind regards >>> >>> Andreas. Andreas> _______________________________________________ Zope Andreas> maillist - Zope@zope.org Andreas> http://lists.zope.org/mailman/listinfo/zope ** No cross Andreas> posts or HTML encoding! ** (Related lists - Andreas> http://lists.zope.org/mailman/listinfo/zope-announce Andreas> http://lists.zope.org/mailman/listinfo/zope-dev )
On Wed, 21 Mar 2001, Steve Spicklemire wrote:
you might also try just:
<dtml-var MenuItem> Thanks for your hints. I tried both (i.Menuitem, MenuItem and also i.MenuItem). The usage of <dtml-var Menuitem> seemed me the best because this is the exact spelling when I use the database connection query test. The column was just named Menuitem regardingless the fact that it is spelled MenuItem in the SQL statement (OK, column names in PostgreSQL are case insensitive - why should they be in Zope??). Moreover there was no table prefix in the test-output.
I wonder if there is an internal object which contains all valid column names I could query. One more idea: If I test the query I have to go through an extra screen where I have to commit that "This query requires no input." Could this cause any problem?
good luck! Thanks for the hints
Andreas.
Andreas Tille <tillea@rki.de> writes:
On Wed, 21 Mar 2001, Steve Spicklemire wrote:
you might also try just:
<dtml-var MenuItem>
<dtml-var menuitem>
Thanks for your hints. I tried both (i.Menuitem, MenuItem and also i.MenuItem). The usage of <dtml-var Menuitem> seemed me the best because this is the exact spelling when I use the database connection query test. The column was just named Menuitem regardingless the fact that it is spelled MenuItem in the SQL statement (OK, column names in PostgreSQL are case insensitive - why should they be in Zope??). Moreover there was no table prefix in the test-output.
Enter the exact query in psql and you'll see PostgreSQL's idea of column names. They are lowercase only unless enclosed in double quotes as in select count(*) as "Anzahl" ...
I wonder if there is an internal object which contains all valid column names I could query.
AFAIK, you can't get at it from DTML.
One more idea: If I test the query I have to go through an extra screen where I have to commit that "This query requires no input." Could this cause any problem?
No, this is the parameter entry screen, with a parameterless query it requires no input. Use lower-case only Siggy -- Siggy Brentrup - bsb@winnegan.de - http://www.winnegan.de/ ****** ceterum censeo javascriptum esse restrictam *******
On 21 Mar 2001, Siggy Brentrup wrote:
<dtml-var menuitem> Oh dear - it's so stupidly simple. Why didn't I tried that??? Thanks for opening my eyes!
I wonder if there is an internal object which contains all valid column names I could query.
AFAIK, you can't get at it from DTML. By the way I would consider it as a good debugging feature ...
Use lower-case only I'll remember this my whole life :).
Kind regards Andreas.
Hi Andreas, Sure.. <dtml-let theResult=sqlQuery> <dtml-var "theResult.names()" html_quote> </dtml-let> -steve
"Andreas" == Andreas Tille <tillea@rki.de> writes:
Andreas> On Wed, 21 Mar 2001, Steve Spicklemire wrote: >> you might also try just: >> >> <dtml-var MenuItem> Andreas> Thanks for your hints. I tried both (i.Menuitem, Andreas> MenuItem and also i.MenuItem). The usage of <dtml-var Andreas> Menuitem> seemed me the best because this is the exact Andreas> spelling when I use the database connection query test. Andreas> The column was just named Menuitem regardingless the fact Andreas> that it is spelled MenuItem in the SQL statement (OK, Andreas> column names in PostgreSQL are case insensitive - why Andreas> should they be in Zope??). Moreover there was no table Andreas> prefix in the test-output. Andreas> I wonder if there is an internal object which contains Andreas> all valid column names I could query. One more idea: If Andreas> I test the query I have to go through an extra screen Andreas> where I have to commit that "This query requires no Andreas> input." Could this cause any problem? >> good luck! Andreas> Thanks for the hints Andreas> Andreas. Andreas> _______________________________________________ Zope Andreas> maillist - Zope@zope.org Andreas> http://lists.zope.org/mailman/listinfo/zope ** No cross Andreas> posts or HTML encoding! ** (Related lists - Andreas> http://lists.zope.org/mailman/listinfo/zope-announce Andreas> http://lists.zope.org/mailman/listinfo/zope-dev )
Postgresql defaults all column names to lower case so Menuitem is actually menuitem try this Dan
<dtml-in GetMainMenu> <dtml-var Menuitem><br> <---------- change to <dtml-var menuitem><br> </dtml-in> <dtml-var standard_html_footer>
Andreas Tille wrote:
Hello,
I really wonder how to do debugging in Zope. I tried several things regarding to the available documentation and because I've got no answer over this list I think there is no problem in the code I posted (see below).
Are there any methods to track down the problem? I know that many people use PostgreSQL with Zope but I wonder how they got their very first example working :-(.
Kind regards
Andreas.
On Tue, 13 Mar 2001, Andreas Tille wrote:
Hello,
I'm using Zope 2.2.2 and zope-pygresqlda 0.3rjr2. I have created the following ZSQL method (here displayed in the "Test"-View):
Z SQL Method at /Control_Panel/Products/Ifsg/GetMainMenu
Idmenushow Idwebseite Menuitem 54 25 Description 57 110 Components 61 71 Objectives 52 20 Links 51 57 About us
SQL used:
SELECT i.IdMenuShow, i.IdWebSeite, i.MenuItem FROM Menu m INNER JOIN MenuItem i ON i.IdMenu = m.IdMenu WHERE m.IdMenu = 52 ORDER BY i.Sort ;
I try to use the output of this Query in the following DTML-document:
DTML Document at /Control_Panel/Products/Ifsg/Databasetest
<dtml-var standard_html_header>
<dtml-in GetMainMenu> <dtml-var Menuitem><br> </dtml-in> <dtml-var standard_html_footer>
If I try to "View" Databasetest I get:
Zope Error
Zope has encountered an error while publishing this resource.
Error Type: KeyError Error Value: Menuitem
Could anybody enlighten me, what's the problem here?
Kind regards
Andreas.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (6)
-
Andreas Tille -
Daniel Rusch -
Oleg Broytmann -
Paolo Comitini -
Siggy Brentrup -
Steve Spicklemire