Mnesia Questions

Sebastian Bello sebastian@REDACTED
Mon Nov 28 14:15:05 CET 2005


Great, thanks.
    Sebastian-

----- Original Message -----
From: "Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED>
To: "Sebastian Bello" <sebastian@REDACTED>; <erlang-questions@REDACTED>
Sent: Monday, November 28, 2005 11:13 AM
Subject: RE: Mnesia Questions



mnesia:load_textfile() supports only its own format,
that is, whatever is produced by dump_to_textfile().


'rdbms' has a data import tool, where you can plug
in different file formats. Currently, a tab-delimited
text format a la mail merge is supported. CSV would not
be difficult to add.

/Uffe

> -----Original Message-----
> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED] On Behalf Of
> Sebastian Bello
> Sent: den 28 november 2005 13:44
> To: erlang-questions@REDACTED
> Subject: Re: Mnesia Questions
>
> Regarding point 3, does 'mnesia:load_textfile' support csv files?
>     Sebastian-
>
> ----- Original Message -----
> From: "Alex Peake" <alex.peake@REDACTED>
> To: <erlang-questions@REDACTED>
> Sent: Monday, November 28, 2005 4:52 AM
> Subject: Mnesia Questions
>
>
> > 1) I set up person as a ram_copies table. I did a
> > mnesia:dump_tables([person]). Then I tried
> > mnesia:change_table_copy_type
> to
> > get to disc_copies and got an error saying "Table dump
> exists". How do
> > I change this table to disc_copies?
> >
> > 2) Can I move the dump of person to another machine by copying the
> > file person.dcd?
> >
> > 3) What is a good way to load a text (csv) file into a
> table? I tried
> > mnesia:load_textfile and it is quite slow.
> >
> > 4) How do I best join two large tables (and get a subset)? I tried:
> >
> > non_english_g3_join() ->
> >     F = fun() ->
> >                 Q = qlc:q([{P#persondata.f2, P#persondata.f1,
> R#person.pkey}
> > || P <- mnesia:table(persondata),
> >                                              R <-
> > mnesia:table(person), P#persondata.personid == R#person.id,
> >                                              P#persondata.f8 == "03"
> orelse
> > P#persondata.f8 == "02", P#persondata.f3 /= "English"]),
> >                 qlc:e(Q)
> >         end,
> >     mnesia:transaction(F).
> >
> > And it went off in the weeds (at least for 45 minutes, when I quit
> waiting).
> >
> > I also tried:
> >
> > sample_join() ->
> >         Q = query
> >             [ {P#persondata.f2, P#persondata.f1} ||
> >                 P <- table(persondata),
> >                 R <- table(person),
> >                 P#persondata.personid = R#person.id,
> >                 P#persondata.f8 = "03",
> >                 P#persondata.f3 /= "English"
> >             ]
> >         end,
> >         F = fun() -> mnemosyne:eval(Q) end,
> >         mnesia:transaction(F).
> >
> >
> > And got:
> >
> > =ERROR REPORT==== 27-Nov-2005::22:32:35 === Error in
> process <0.478.0>
> > with exit value:
> > {{nocatch,{'EXIT',mnemosyne_not_runn
> >
> ing}},[{mnemosyne_lc,the_query,1},{person,sample_join,0},{erl_
> eval,do_apply,
> > 5},{
> > shell,exprs,6},{shell,eval_loop,3}]}
> >
> > ** exited: {{nocatch,{'EXIT',mnemosyne_not_running}},
> >             [{mnemosyne_lc,the_query,1},
> >              {person,sample_join,0},
> >              {erl_eval,do_apply,5},
> >              {shell,exprs,6},
> >              {shell,eval_loop,3}]} **
> >
> >
> > Yet:
> >
> > sample_mq() ->
> >         Q = query
> >             [ {P#persondata.f2, P#persondata.f1} ||
> >                 P <- table(persondata),
> >                 P#persondata.f8 = "03",
> >                 P#persondata.f3 /= "English"
> >             ]
> >         end,
> >         F = fun() -> mnemosyne:eval(Q) end,
> >         mnesia:transaction(F).
> >
> > works.
> >
> >
> >
>
>




More information about the erlang-questions mailing list