[Zope-DB] Process one PloneFormGen request into many SQL tables

Charlie Clark charlie at egenix.com
Fri Jan 19 11:48:57 EST 2007

Am 19.01.2007, 14:30 Uhr, schrieb Paul Eipper <lkraider at gmail.com>:

> I have a Form (generated with PloneFormGen+DataGridField) and I need
> to send the data entered there into several mySQL tables. I am
> guessing a Python script would be the right thing here.(?)

Can't tell you much about what the Plone thing wants but a PythonScript is  
probably indeed what you want.

>  My main questions right now are:
>  1) How do I maintain referencial integrity?
> I need to get LAST_INSERT_ID() from the first INSERT to use on the
> following inserts.
> Could I have a ZSQL Method that does the insert and returns the
> generated ID to the Python script?

Yes, or you could call do this call directly in SQL or possibly even in  
the default for a particularl relational variable.

>  2) Is a ZSQL Method automatically executed as a transaction? Or do I
> need to manually define BEGIN; COMMIT; to guarantee I am getting the
> correct data?


>  3) Where can I find example code (zsql, python scripts) dealing with
> many related tables? All tutorials I found deal with only one table at
> a time, completely ignoring the relational part of the database.

Well, to be honest they only show you how to use SQL from within Zope  
which is essentially write the SQL yourself and let Zope help you manage  
your variables.


More information about the Zope-DB mailing list