Introduction
Building from the Simple SQL CRUD tutorial by Steve McMahon, this tutorial will demonstrate some of the techniques that can be used to work with relational databases.
Most of the work here will be in developing Python Scripts that will do the logic and ZSQL Methods to communicate to the database. Hopefully, in some time we will all be using the Alchemist product to help us in that area.
Note that this tutorial will show just one of the possible ways of working with forms and relational databases in Plone, and should be adapted as necessary. Take this as a starting guide into this realm :)
Skills necessary for this tutorial:
- Have already followed the Simple SQL CRUD tutorial. You should already have a basic idea on how to work with PloneFormGen and databases, and have setup Zope correctly for this.
- Database SQL knowledge, to create and/or adapt the examples to your database. It's also expected you have already connected the database into Zope and know how to use ZSQL Methods. The examples are based on mySQL using InnoDB, so you should know how to write correct equivalent SQL for your preferred backend.
- Python scripting knowledge is necessary to adapt the general examples given here. Note that you don't need to be a master programmer, but you must know your way around with Python.
- DataGridField for PloneFormGen, that was introduced in version 1.1. For this you need to install the DataGridField product, then copy the folder PFGDataGrid from the PloneFormGen/examples to your Plone Products folder and install it.
What we will do is:
- Create a form to insert data into related tables.
- Do the wiring work in Python + ZSQL Methods to insert the form data.
- Create a search interface to retrieve the data.
- Create an advanced search to filter by fields.
- Adapt the insert form to use for updating data.
- Delete data.

