[Zope] future-proofing content

Max M maxm@mxm.dk
Tue, 02 Apr 2002 14:10:04 +0000


mike gallagher wrote:

>Two questions: 
>1. Is it good practice to store all my content (press
>releases, news stories etc) in an external relational
>database? I think this will ensure that if the company
>decide to get rid of Zope, it'll be easier to re-use
>the content. Is this overkill? Is it easy to export
>content from the Zope OO database into a relational
>db? (Yes,I'm a newbie!) 
>

If your data is tabular in content, it is no more diffucult to pull out 
the data from Zope than from a sql based db.

Something like the below simplified code will do it for you.

articles = self.ZopeFind(self, obj_metatypes='article', search_sub=1)
con = openDB() # pseudo code
for article in articles:
    sql = """
    INSERT INTO articles (title, summary, content)
    VALUES (?,?,?)
    """
    con.execute(sql, (article.title, article.summary, article.content))
con.close()

regards Max m