ruby/python database tutorial?
September 12, 2006 3:29 PM   Subscribe

I'm searching for a simple ruby/python database application tutorial. A long time ago, like six years ago, I came across this simple tutorial for php/mysql that showed you, from the ground up, how to put a simple database of your video collection online. Is there a similar tutorial that emphasizes creating a simple front-end for a mysql database using ruby or python, geared toward n00bs?

Using either Ruby or Python I want to write an application that lets users do three things:

1. log in
2. input a single number, tied to the day's date.
3. display the user numbers sorted by date in descending order.

anyway, if anyone knows of a simple tutorial for using ruby/python with mysql, that would be awe-some.
posted by mecran01 to Technology (5 answers total) 6 users marked this as a favorite
 
Response by poster: Ok, here's one ruby/mysql tutorial that I overlooked:

http://www.rubywizard.net/ruby-mysql.html
posted by mecran01 at 3:44 PM on September 12, 2006


Response by poster: Gak!
Here is a tutorial on using python/django to make a simple web poll application. It should be really helpful

linky linky

Don't know why I didn't find this sooner--must be the NADH kicking in :)
posted by mecran01 at 3:50 PM on September 12, 2006


Best answer: I'd reccomend using sqlobject. Its a database tool for python that lets you treat the database as a set of normal python classes and objects. The tutorial from the manual is here, wi but its so simple it practically doesn't need a tutorial. Here's an example:

from sqlobject import *
from datetime import datetime
sqlhub.processConnection = connectionForURI('mysql://user:password@host/dbname')

class MyThing(SQLObject):
  description = StringCol()
  date = DateCol()

MyThing.createTable()
thing1 = MyThing(description='This is the first thing', date=datetime(2006, 9, 12))
thing2 = MyThing(description='This is another thing', date=datetime(2006, 9, 10))

for thing in MyThing.select(orderBy='date'):
  print 'thing %i: %s' % (thing.id, thing.description)
  
SQLObject is well integrated with TurboGears, a python web development framework that has one of the best tutorials I've ever seen: the 20 minute wiki. Definitely check it out if you're looking for a way to get a database website up in python with a minimum of fuss.

For the record, I dislike ORMs, but in this case they serve their purpose.
posted by gsteff at 3:54 PM on September 12, 2006


Response by poster: Thanks, gsteff. That syntax even makes sense to a non-programmer like myself.
posted by mecran01 at 4:56 PM on September 12, 2006


You might also have good luck with Django. It's still somewhat newish, but really nifty stuff: Django Project.
posted by jzb at 9:02 PM on September 12, 2006


« Older Suitcase debacle   |   Guilt and the poor relation's story Newer »
This thread is closed to new comments.