Now we open legal.xls in gnumeric (or any spreadsheet program).ssformat dbi:mysql:dcp_development:username=root:table=legal_structures legal.xls

That's better. Now to send the change to mysql. First, a sanity check, to make sure I've changed what I thought I did, and nothing else:
This reports:ssdiff dbi:mysql:dcp_development:username=root:table=legal_structures legal.xls
Good, that's it. I'm getting tired of typing that big dbi: reference to mysql, so let's take a second to make a reference file for it, say legal_mysql.json:# tdiff version 0.3
@@@ legal_structures
= |id=7|name=Non-profit Corporation->Non-Profit Corporation|
{
"type": "mysql",
"database": "dcp_development",
"username": "root",
"table": "legal_structures"
} Now I send the change to mysql:
Now, time goes on, and changes happen in the database from some other source. I want to edit the table in gnumeric again. I can avoid having to redo the formatting I did (bold header, column widths) if I pull in the changes as diffs, rather than regenerating the spreadsheet:
The interface is definitely a bit geeky though. I look forward to improving that.
Done! Just to be sure, let's see if the change got made:ssdiff --apply legal_mysql.json legal.xls
This reports:ssformat legal_mysql.json | grep Non
Good, that has the right capitalization.7,"Non-Profit Corporation",0,"2010-03-01 16:36:34","2010-03-01 16:36:34"
Now, time goes on, and changes happen in the database from some other source. I want to edit the table in gnumeric again. I can avoid having to redo the formatting I did (bold header, column widths) if I pull in the changes as diffs, rather than regenerating the spreadsheet:
This makes me ridiculously happy. And ssformat/ssdiff support .csv files (or a custom .csvs text format for sets of tables), so I can use a text editor when that is appropriate. This is the most comfortable way I've found to edit mysql, sqlite, and Excel tables in emacs.ssdiff --apply legal.xls legal_mysql.json
The interface is definitely a bit geeky though. I look forward to improving that.


No comments:
Post a Comment