Monday, March 1, 2010

Data Loss Is Bad

Admittedly, I did not get much done this week. Was shooting for getting a lot of work done this past weekend, but I caught a pretty bad cold and slept for the most part. Too bad, because it seems like more people might be switching over to my Pinax implementation. Guess that means I better get started on that documentation as well.

That's not to say I did nothing. Before my meeting with Philip last weekend, I had done something pretty stupid. I deleted my database and resynced it. Of course, it's only a development database, so nothing important was lost. However, since most of the content on the site is backed by the database, I lost all of it and had to retype it in before the meeting. To prevent this from happening again, I thought I'd create a sqlite dump so that I can rebuild it. However, I realized that I didn't need the create table statements (since they'll be made when I resync the database). Also, some of the Django tables already have data in them, which caused sqlite to complain about having duplicate entries in some tables. Not the way to go.

In Rails, we filled our development database with fixtures, which are some sample content that is stored in a few files. So I looked for a way to dump my data into fixture files and then have them load up in Django. Using "manage.py dumpdata", I dumped only the tables that contained the content in the site. Then, I removed the database and resynced it. Then, using "manage.py loaddata", I restored the content. Unfortunately, I had to change a few foreign keys, but it seems to be okay now. So my little dumb mistake lead me to this discovery, which will be important when other programmers start working on it.

My meeting with Philip was fairly quick. It was then that it was decided that this will probably be the main implementation of the dorm energy competition. I started doing some research on integrating Python applications with Hudson, our continuous integration server. I found a blog post entitled Django and Hudson and Bears, Oh My! (and twill, and figleaf), which is a great walkthrough of how to integrate Django and Hudson. I also need to investigate using Django/Pinax, Hudson, and Selenium together to do automated browser testing. A lot to do in a week, so we'll see how it goes.

No comments:

Post a Comment