Dumping a mnesia database in a standard format

Ulf Wiger ulf@REDACTED
Thu Aug 4 10:53:08 CEST 2005


Den 2005-08-04 09:59:22 skrev Hakan Mattsson <hakan@REDACTED>:

> On Wed, 3 Aug 2005, Sebastian Bello wrote:
>
> SB> more mnesia questions. Does anybody know of a tool to dump a
> SB> mnesia database to a file, but in a format suitable for loading it
> SB> into a non-mnesia (relational) database? I know it shouldn't be hard
> SB> to write such a tool, just wanna know is one already exists.
>
> Mnesia has no such support off the shelf.
> But you may write your own Mnesia backup
> callback module to handle any backup media
> or file format.
>
> For example you may use a simple text format
> with one record per row and the attributes
> separated with some unique character (e.g. tab).
> But you should probably limit your records to
> only contain data that are easily transformed
> to types that a RDBMS may represent.


Time to shamelessly plug one of my own contribs (again).
One way to impose type limits on mnesia is to use rdbms
(found in jungerl). It allows you to specify types for
each attribute, and verifies that all records written
conform to the specifications. It also has a generic
data import module, into which you can plug in your own
import formats (the one format supported is tab-delimited
text with a header row, which is a fairly common format
for e.g. mail merge).

One could expand rdbms with an export tool as well, perhaps
in a way that you can fairly easily specify import and
export support at the same time for a new format. One could
also imagine somehow extending the set of possible meta-data
in rdbms to give better support for data export (i.e.
specify how a data object should be represented externally.)

/Uffe
-- 
Ulf Wiger



More information about the erlang-questions mailing list