Re: [ZOPE] ZBabel translation to Postgres
hi Andrew and others,
I get errors: when i first want to view a page with the <dtml-babel src=uk dst=de> test</dtml-babel>
pg.error error value: error: attribute 'phrases_phrase_id_seq' not found
i changed the column name of the id from "phrase_id" to "id" and get still the same error message as above. so i figured that my bug is not in my changes but somewhere in the python code. do you have any help? thanks olaf
you need in postgresql (this is tested only from zope with zsql method, since some other things don't work in the ZBabel Produkt with postgresql):
sqlGetPhrasesToUpdate:
select distinct Phrases.*
WHERE md5Hash not in ( select c.md5Hash from Phrases as c, Phrases as d where c.md5Hash = d.md5Hash and c.lang <> d.lang and c.lang='<dtml-var srcLang>' ) and lang <>'<dtml-var srcLang>'
sqlNewPhrase:
insert into Phrases (phrase_id,lang,md5Hash,renderPath,renderText) values ( nextval('phrases_phrase_id_seq'), <dtml-sqlvar lang type=nb>, <dtml-sqlvar md5Hash type=nb>, <dtml-sqlvar renderPath type=nb>, <dtml-sqlvar renderText type=nb> )
all other sqlFunctions seam to work (out of zope ZSQL method)
i attache the ZBabel.sql for postgres. the examples are handgenerated so the hashes are fake.
TAKE CARE until now this just fakes the ability of ZBabel on Postgres on a ZSQL Method level for testing purposes.
I get errors: when i first want to view a page with the <dtml-babel src=uk dst=de> test</dtml-babel>
pg.error error value: error: attribute 'phrases_phrase_id_seq' not found
probably that helps anybody
olaf
| What does the whole thing do anyway?
Finds all the phrases that don't have a translation for the language selected. It's hard to find things that don't exist in databases without nested selects which MySQL did not have at the time.
MySQL was chosen precisely because it is restricted, and is basically the lowest common denominator when it comes to SQL.
I do recall however, that postgres only implements INNER and OUTER joins although I don't know the status of the JOIN stuff in postgres at this time.
| Has anybody ported ZBabel already?
Someone was going to send me patches for postgres, but, I never received them.
I'll happily integrate patches, although, automatically selecting the right query based on database type will be required so that several releases aren't required. I don't think that that's a hard thing to achieve.
-- soli-con Engineering Zanger Dipl.-Ing. (FH) Olaf Marc Zanger Lorrainestrasse 23 3013 Bern / Switzerland Fon: +41-31-332 9782 Mob: +41-76-572 9782 mailto:info@soli-con.com mailto:olaf.zanger@soli-con.com http://www.soli-con.com -- Sent through GMX FreeMail - http://www.gmx.net
+-------[ Olaf Zanger ]---------------------- | hi Andrew and others, | | > I get errors: | > when i first want to view a page with the <dtml-babel src=uk dst=de> | > test</dtml-babel> | > | > pg.error | > error value: error: attribute 'phrases_phrase_id_seq' not found | | i changed the column name of the id from "phrase_id" to "id" and get | still the same error message as above. | so i figured that my bug is not in my changes but somewhere in the | python code. you need to make sure you create a table with a SERIAL type, which automatically create phrases_phrase_id_seq table (which is why it should be called phrase_id in your case). These are normally created for you, but, if you drop the table, it doesn't automatically drop the sequence table. You might have to drop the table and the sequence and re-create your table so you get the correct table setup. Postgres can be a complete pain at times. -- Totally Holistic Enterprises Internet| P:+61 7 3870 0066 | Andrew Milton The Internet (Aust) Pty Ltd | F:+61 7 3870 4477 | ACN: 082 081 472 ABN: 83 082 081 472 | M:+61 416 022 411 | Carpe Daemon PO Box 837 Indooroopilly QLD 4068 |akm@theinternet.com.au|
participants (2)
-
Andrew Kenneth Milton -
Olaf Zanger