On Wed, Mar 23, 2016 at 10:50 AM, Luca Ferrari <fluca1978 at infinito.it>
wrote:

> ...The problem is that .dump provides data and schema, while I'd like to
> have data only.
> Other commands like .clone and .backup works pretty much the same, as
> far as I understand.
>
> This leads me to either use awk/sed to manipulate the dump or to
> hard-code single select statements into the script to extract data.
> Is there any smarter way to dump only data in a loadable form?
>


Probably the simplest approach is something like (untested):

alter table original_table rename to foo; -- move the original table
create table original_table (...); -- w/ new schema
insert into original_table (a,b,c) select a,b,c from foo; -- assuming no
transformation needs to take place
drop table foo; -- though you'll probably want to keep the old copy "just
in case"


-- 
----- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf

Reply via email to