[DB-SIG] Beginner in troubles.

Andy Todd andy47@halfcooked.com
Mon, 18 Mar 2002 20:32:20 +1100


Ignacio Guerrero wrote:

> I have a little problem... be patient, I'm a beginner.
> I'm exercising my newly aquired skills and I found myself with a problem 
> that outskills me.
> I'm writing a script that:
> -asks you if you're a new user or a registred one.
> -then, if you're new, asks you to:
>  -fill a form with personal data...
>  -and prompts you for a userName and a userPass (which you have to type 
> twise with exact spelling).
>  -then, verifies if the userName is already taken or not and...
>   -if it is, takes you back to the previous prompt or...
>   -if it's not, adds your pass and Id to a database file.
> -I leave the else: to you :-)
> 
> Now, my problem is that I'm not working with a database file but with a 
> text file, appending the userName and the userPass to it, and retrieving 
> them later.
> What I want to know is: How do I work with a database file?
> 
> I work under Windows 98 (sadly, I wish I could use Linux, but my mom 
> would die, or may be kill me.)
> -I have looked for every tutorial and nothing...
> -I went to the SQL site, red a tutorial... looks easy.
> -I had no troubles with Python, so far... lots of doc.
> -I had no troubles with Tkinter nor wxPython either... lot of doc too.
> -But (and it's a big BUT)... I can't find a single tutorial for 
> beginners on working with DB's under Windows OS.
>  -Should I download a Db's API?
>  -Should I create a DB file or does my script should do that?
>  -How do I link the data generated by my script to de DB file?
> 
> ”””HEEEEEEEEELP!!! Please.
> 
> If it sounds like a stupid question just tell me where to FAQ myself 
> (FAQ... I said FAQ).
> Thanks.
> Ignacio.

Ah,


You've hit a bit of a problem area there I believe. I searched Google 
for 'python database tutorial' and the results were a little sparse to 
say the least.


I think the problem here is that most people who come to the DB-SIG know 
how to use databases and how to program in Python but just need to join 
those two areas of knowledge together.

I think it would be a very good idea to write a getting started type 
document which could fit into the Python HOWTO Documents 
(http://py-howto.sourceforge.net). Sadly, I don't have the time to do it 
but if anyone would like to volunteer ...

If you want to persevere with a relational database the one I've had the 
most success with on Windows 98 is MySQL. You can download the database 
from http://www.mysql.com/ and the DB-API module from 
http://sourceforge.net/projects/mysql-python.

In the short term, if a full blown relational database is too much to 
learn in the short term maybe you should check out the anydbm module 
(http://www.python.org/doc/lib/module-anydbm.html).

Whichever you choose please let us know how you get on and the list is 
always here for you to ask questions if you get stuck.

Regards,
Andy
-- 
-----------------------------------------------------------------------
 From the desk of Andrew J Todd esq.
"So I curtailed my Walpoling activities, sallied forth and infiltrated
  your place of purveyance to negotiate the vending of some cheesy
  comestibles." - Monty Python.