> I'm looking to create a prog that will store disparate bits of info > all linked together, i.e. address details for a person, transaction > records, specific themes, and the ability to search by certain > criteria, so I'm pretty sure I want a database.
Sounds a lot like it! > Can anyone recommend a useful database library for Python that's not > too complex? MYSql gets a lot of fans. PostGres is also popular and both are free. My personal favourite although I'm not sure the free version is still available is Borland's Interbase (and there was an open source spinoff too - Firebird - not to be confused with the mail tool! I just checked and Interbvase is still free to download. A comparison of all 3 can be found here: http://www.skippingdot.net/2002/02/01 > Also, I keep hearing about SQL, would this be the best way to go? I > don't know much about databases. You should learn SQL. Its a very powerful and useful tool for any kind of serious data work and is fairly portable between databases from MS Access on a PC to IBMs DB2 on a mainframe. Basic use is very easy: SELECT FIELD1,FIELD2,... FROM TABLE1,TABLE2 WHERE TABLE.FIELD <CONDITION> VALUE ORDER BY FIELD And you can abbreviate it as needed and add extra complexity too. Here is a more concrete example: SELECT Name, Age FROM Student WHERE Age > 30 ORDER by Name Will return a tuple of Name, Age pairs for all records in the Student table where the age is greater than 30 and sorted by student name. Now think about how much Python code youd need to do that from a flat file... Doable but much harder work. Now lets start linking data together: SELECT Name, Age, Course.Name FROM Student, Course WHERE Age > 30 AND Student.CourseID = Course.CourseID ORDER BY Name Here we are linking the course table with the student table so we can see which courses our mature students are studying. There are lots of other things you can do including nesting select statements, only having unique values output etc. The other advantage is that if you just want to explore your data most databases will provide an interactive prompt (like Pythons >>>) where you can interactively type SQL queries so the development style is very like Python and the two can be used together very easily and naturally. (Maybe I could do a SQL primer as part of my advanced topics section in the tutorial... hmm. An intro to SQL then the next topic showing how to use the Python DBAPI to link SQL and Python - any takers for that idea?) Alan G Author of the Learn to Program web tutor http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
