Re: Easily Import/Export tables

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Sep 07 2009 - 09:12:26 EDT

  • Next message: Arnaud Garcia: "DataContext cache WICKET"

    Hi there,

    Cayenne may not have built in data migration tools that would fit
    every scenario, although there's been some attempts to write them [1].
    At the same time Cayenne is a good *platform* for writing such tools
    based on either objects (de)serialization, or direct migration [1],
    and less so for SQL-based migrations (although that's also possible).

    Note on the XML approach... Current XML (de)serialization API [2] is
    too raw for my liking, but coincidentally last week I started writing
    a tool based on XStream [3] to serialize designated object subgraphs
    (subsets of a large DB defined based on some rules), with the goal of
    loading that data to another DB or back to the same DB (i.e. cloning).
    The code turned out to be pretty simple and powerful. It can handle
    databases of practically any size, and define subgraph scope in terms
    of mapped relationships. Not yet sure if that becomes open source
    though.

    Finally if your export/import rules are something simple (e.g.
    "transfer the entire DB"), I'd strongly suggest to investigate dump/
    load tools provided by your database. All of the major DB's have them.
    This may save you from reinventing the wheel.

    Cheers,
    Andrus

    [1] http://cayenne.apache.org/doc/cdataport.html
    [2] http://cayenne.apache.org/doc/api/org/apache/cayenne/xml/package-summary.html
    [3] http://xstream.codehaus.org/

    On Sep 7, 2009, at 5:07 AM, open.pumpkin wrote:

    > Hello,
    >
    > Is it possible to export tables using a dedicated cayenne function ?
    >
    > I would like to export one or more tables (and data), specified by
    > the user
    > of my application, to import them in another environment (for
    > example from
    > development to production).
    >
    > The ideal thing would be a SQL script generated by cayenne,
    > independant of
    > databases and cayenne (I could use it with Mysql query browser, for
    > example).
    >
    > Else, using serialization of cayenne objects ?
    > Or another possibility ?
    >
    > The interest is to not manually write SELECT and UPDATE statements.
    >
    > Thanx.
    > O.P.



    This archive was generated by hypermail 2.0.0 : Mon Sep 07 2009 - 09:13:07 EDT