[Zope-DB] Re: Zope-DB Digest, Vol 42, Issue 16

Michael Mauws mmauws at gmail.com
Fri Jan 26 14:58:35 EST 2007


Another way to address Graziella's problem is to simply not create
what is being referred to as Table 1. Instead, use a join when
displaying the results and use two separate insert statements within
the ZSQL method to deal with insertions. For example, in the query
ZSQL method Graziella could include something like:

SELECT t1.col1, t2.col1
FROM table1 t1, table2 t2
WHERE t1.key = t2.key

And in the insert ZSQL method, Graziella could write something like:

INSERT INTO table1 (col1, col2, ...) VALUES(<dtml-sqlvar Table1Value1
type=int>, ...)
<dtml-var sql_delimiter>
INSERT INTO table2 (col1, col2, ...) VALUES(<dtml-sqlvar Table2Value1
type=int>, ...)


...Michael



On 1/26/07, zope-db-request at zope.org <zope-db-request at zope.org> wrote:
> Send Zope-DB mailing list submissions to
>         zope-db at zope.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://mail.zope.org/mailman/listinfo/zope-db
> or, via email, send a message with subject or body 'help' to
>         zope-db-request at zope.org
>
> You can reach the person managing the list at
>         zope-db-owner at zope.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Zope-DB digest..."
>
>
> Today's Topics:
>
>    1. modifications on a query (Graziella Toutoungis)
>    2. Re: modifications on a query (Andreas Jung)
>    3. Re: modifications on a query (Maciej Wisniowski)
>    4. Re: modifications on a query (Charlie Clark)
>    5. RE : Re: [Zope-DB] modifications on a query (Graziella Toutoungis)
>    6. Re: RE : Re: [Zope-DB] modifications on a query (Charlie Clark)
>    7. Re: RE : Re: [Zope-DB] modifications on a query
>       (Maciej Wisniowski)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 26 Jan 2007 07:37:25 +0000 (GMT)
> From: Graziella Toutoungis <graztoutoungis at yahoo.fr>
> Subject: [Zope-DB] modifications on a query
> To: zope-db at zope.org
> Message-ID: <386171.67741.qm at web27002.mail.ukl.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
>
>
> Hello,
>
> I use zope2.9.4 with postgresql8.1, in my database i have some tables are the result  of a query on other tables.
> exe: table1 is the result of table2 with table3
>
> My
> user can connect to the database and he can modify the  table1, this
> modification should done on the orginals tables table2 and table3
>  my
> problem is how  i can  specify the origin of the column in table for
> verifing that table2 and table3 may this modifications?
>
> thanks for all suggetions.
>
>             G.
>
>
>
>
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
>
>
>
>
>
>
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
>
>
>
>
>
>
>
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses.
>
>
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: http://mail.zope.org/pipermail/zope-db/attachments/20070126/e5900565/attachment-0001.htm
>
> ------------------------------
>
> Message: 2
> Date: Fri, 26 Jan 2007 08:48:31 +0100
> From: Andreas Jung <lists at zopyx.com>
> Subject: Re: [Zope-DB] modifications on a query
> To: Graziella Toutoungis <graztoutoungis at yahoo.fr>, zope-db at zope.org
> Message-ID: <E828C9E4715FD97D8E557ECC at suxmac2.local>
> Content-Type: text/plain; charset="us-ascii"
>
>
>
> --On 26. Januar 2007 07:37:25 +0000 Graziella Toutoungis
> <graztoutoungis at yahoo.fr> wrote:
>
> >
> >
> > Hello,
> >
> > I use zope2.9.4 with postgresql8.1, in my database i have some tables are
> > the result  of a query on other tables.  exe: table1 is the result of
> > table2 with table3
> >
> > My
> > user can connect to the database and he can modify the  table1, this
> > modification should done on the orginals tables table2 and table3
> >  my
> > problem is how  i can  specify the origin of the column in table for
> > verifing that table2 and table3 may this modifications?
> >
>
> Please rephrase your question and point out the Zope specific part of the
> question.
>
> -aj
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: not available
> Type: application/pgp-signature
> Size: 186 bytes
> Desc: not available
> Url : http://mail.zope.org/pipermail/zope-db/attachments/20070126/c8f6d41e/attachment-0001.bin
>
> ------------------------------
>
> Message: 3
> Date: Fri, 26 Jan 2007 09:05:50 +0100
> From: Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl>
> Subject: Re: [Zope-DB] modifications on a query
> To: Graziella Toutoungis <graztoutoungis at yahoo.fr>
> Cc: zope-db at zope.org
> Message-ID: <45B9B65E.6080701 at coig.katowice.pl>
> Content-Type: text/plain; charset=ISO-8859-1
>
>
> > I use zope2.9.4 with postgresql8.1, in my database i have some tables
> > are the result  of a query on other tables.
> > exe: table1 is the result of table2 with table3
> >
> > My user can connect to the database and he can modify the  table1,
> > this modification should done on the orginals tables table2 and table3
> >  my  problem is how  i can  specify the origin of the column in table
> > for verifing that table2 and table3 may this modifications?
> >
> > thanks for all suggetions.
> Is table1 a view?
> What does 'table2 with table3' mean?
> If you have SQL statement like:
>
> select col1, col2, col3 from ....
>
> then you know where columns come from... don't you?
>
> --
> Maciej Wisniowski
>
>
> ------------------------------
>
> Message: 4
> Date: Fri, 26 Jan 2007 14:07:32 +0100
> From: "Charlie Clark" <charlie at egenix.com>
> Subject: Re: [Zope-DB] modifications on a query
> To: "Graziella Toutoungis" <graztoutoungis at yahoo.fr>,   zope-db at zope.org
> Message-ID: <op.tmriqu1dy861uf at fuchsia.local>
> Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
>
> Am 26.01.2007, 08:37 Uhr, schrieb Graziella Toutoungis
> <graztoutoungis at yahoo.fr>:
>
> >
> > Hello,
> > I use zope2.9.4 with postgresql8.1, in my database i have some tables
> > are the result  of a query on other tables.
> > exe: table1 is the result of table2 with table3
> > My
> > user can connect to the database and he can modify the  table1, this
> > modification should done on the orginals tables table2 and table3
> >  my
> > problem is how  i can  specify the origin of the column in table for
> > verifing that table2 and table3 may this modifications?
>
> I am not exactly sure what you wish to do: is table1 simply a view based
> on a query of table2 and table3? It certainly sounds like it should be.
> But I am not sure if you update views in PostgreSQL that the original
> tables get updated.
>
> You might wish to ask your question again in French as some of us will at
> least understand it like that.
>
> Anway if you wish to update tables based on the results of queries in Zope
> you are probably best using a PythonScript to link the appropriate queries
> if this is not directly possible in SQL.
>
> ie.
>
> results = context.SQL.someQuery()
> for result in results:
>      context.SQL.anotherQuery(result) # you probably wish to pass a
> dictionary based on the first query in
>
> Charlie
>
>
>
> ------------------------------
>
> Message: 5
> Date: Fri, 26 Jan 2007 14:17:03 +0100 (CET)
> From: Graziella Toutoungis <graztoutoungis at yahoo.fr>
> Subject: RE : Re: [Zope-DB] modifications on a query
> To: Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl>
> Cc: zope-db at zope.org
> Message-ID: <580218.14687.qm at web27005.mail.ukl.yahoo.com>
> Content-Type: text/plain; charset=iso-8859-1
>
> in my database i want to create a table1 who is the
> result of a query on table2 and table3 like select
> x2,y2,x3,y3 from table2 and table3...
> -i want now to create the table1.
> -evrey time the user try to insert into table1, i must
> insert this data in the original table and verify the
> possibility of the insertion.
>
> my code now return a list of column name's like
> ['id', 'title','phon',...]
> i want to create table1 from this list, i don't know
> how i can do it, my code is:
>
>  query ="SELECT id, name, value, shipping FROM
> customer, invoice, orderinfo WHERE customer.id =
> invoice.customer_id            AND
> invoice.order_id=orderinfo.order_id;"
>
>     print query
>
>     curs.execute(query)
>
>     names= [f[0] for f in curs.description]
>     print 'names%s' %names
>     tableColumn = []
>     for name in names:
>         tableColumn.append(name)
>
>
>     value = []
>     for row in curs.fetchall():
>         for pair in zip(row):
>             value.append(pair)
>             print '%s' %pair
>         print
>
>     print value
>
>     i = 0
>     column=[]
>
>     for x in tableColumn:
>             test = tableColumn[i].strip()
>             i += 1
>             print test
>             column.append(test)
>     print column
>
>
>
> #    createQuery = 'CREATE TABLE test_fetch
> %s'%tableColumn
> #    print createQuery
>
>     curs.execute("DROP TABLE test_fetch")
> #    curs.execute(createQuery)
>
> i will integrate in zope this code to create a form in
> order to give the users the capability to manage my
> database.
>
> any suggestions?
>
> --- Maciej Wisniowski
> <maciej.wisniowski at coig.katowice.pl> a écrit:
>
> >
> > > I use zope2.9.4 with postgresql8.1, in my database
> > i have some tables
> > > are the result  of a query on other tables.
> > > exe: table1 is the result of table2 with table3
> > >
> > > My user can connect to the database and he can
> > modify the  table1,
> > > this modification should done on the orginals
> > tables table2 and table3
> > >  my  problem is how  i can  specify the origin of
> > the column in table
> > > for verifing that table2 and table3 may this
> > modifications?
> > >
> > > thanks for all suggetions.
> > Is table1 a view?
> > What does 'table2 with table3' mean?
> > If you have SQL statement like:
> >
> > select col1, col2, col3 from ....
> >
> > then you know where columns come from... don't you?
> >
> > --
> > Maciej Wisniowski
> >
>
>
>
>
>
>
>
> ___________________________________________________________________________
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions !
> Profitez des connaissances, des opinions et des expériences des internautes sur Yahoo! Questions/Réponses
> http://fr.answers.yahoo.com
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 26 Jan 2007 14:23:24 +0100
> From: "Charlie Clark" <charlie at egenix.com>
> Subject: Re: RE : Re: [Zope-DB] modifications on a query
> To: "Graziella Toutoungis" <graztoutoungis at yahoo.fr>,   "Maciej
>         Wisniowski" <maciej.wisniowski at coig.katowice.pl>
> Cc: zope-db at zope.org
> Message-ID: <op.tmrjhaf9y861uf at fuchsia.local>
> Content-Type: text/plain; format=flowed; delsp=yes; charset=utf-8
>
> Am 26.01.2007, 14:17 Uhr, schrieb Graziella Toutoungis
> <graztoutoungis at yahoo.fr>:
>
> >     curs.execute("DROP TABLE test_fetch")
> > #    curs.execute(createQuery)
> > i will integrate in zope this code to create a form in
> > order to give the users the capability to manage my
> > database.
> > any suggestions?
>
> Yes, you might want to look at existing products for managing
> tables/queries in Zope. Otherwise you should consider creating a Zope file
> system product and check that you can access the execute() method of the
> DA. This is certainly possible for our mxOBDC Zope DA but I think the
> ZpyscopgDA also supports it.
>
> Charlie
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 26 Jan 2007 14:24:25 +0100
> From: Maciej Wisniowski <maciej.wisniowski at coig.katowice.pl>
> Subject: Re: RE : Re: [Zope-DB] modifications on a query
> To: Graziella Toutoungis <graztoutoungis at yahoo.fr>
> Cc: zope-db at zope.org
> Message-ID: <45BA0109.6000105 at coig.katowice.pl>
> Content-Type: text/plain; charset=ISO-8859-1
>
>
> > any suggestions?
> Write a procedure in the database that
> does this and just call this procedure from Zope.
>
> --
> Maciej Wisniowski
>
>
> ------------------------------
>
> _______________________________________________
> Zope-DB mailing list
> Zope-DB at zope.org
> http://mail.zope.org/mailman/listinfo/zope-db
>
>
> End of Zope-DB Digest, Vol 42, Issue 16
> ***************************************
>


More information about the Zope-DB mailing list