my new project, is this the right way?

Redcat redcat at catfolks.net
Mon Nov 14 10:47:17 EST 2011


> since i'm mostly a new-bye for as regard databases, my idea is to use
> sqlite at the beginning.
> 
> Is that ok? any other db to start with? (pls don't say mysql or similar,
> they are too complex and i'll use this in a second step)

I know it's a lot of work to learn initially, but I would recommend 
taking the time to install and become familiar with a database engine 
such as MySQL or PostgresQL. While SQLite is easy to install and easy to 
use, it also cuts a lot of corners and allows you to do things that would 
die in a real database. For example, in SQLite column types are merely 
suggestions; there is nothing in SQLite to keep you from storing a string 
in an integer field or vice versa.

For example:

dan at dan:~/work$ sqlite3
SQLite version 3.7.3
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table test (
   ...> id int,
   ...> name varchar(64),
   ...> comment varchar(256)
   ...> );
sqlite> .schema test
CREATE TABLE test (
id int,
name varchar(64),
comment varchar(256)
);
sqlite> insert into test values (1, 'Dan', 'Normal insert with valid 
types');
sqlite> insert into test values ('Bogosity', 2, 'Record with invalid 
types');
sqlite> insert into test values ('This field should be an int but is 
really a long string instead', 12.45, 'A really screwy record');
sqlite> select * from test;
1|Dan|Normal insert with valid types
Bogosity|2|Record with invalid types
This field should be an int but is really a long string instead|12.45|A 
really screwy record
sqlite> 


This is not to say that SQLite is useless. Far from it - I use it 
frequently myself. But I've been working with SQL databases for a bunch 
of years, and I am familiar with the tradeoffs involved in working with 
SQLite. 

A decent tutorial on working with SQL in general can be found at http://
www.w3schools.com/sql/sql_intro.asp

Installing MySQL or Postgres can be fairly simple, if you use the tools 
provided with your Linux distro (assuming you're running on Linux). "sudo 
apt-get install mysql mysql-server" or "yum install mysql mysql-server" 
should get you what you need to start using MySQL, "sudo apt-get install 
postgresql" or "yum install postgresql" should get you started with 
PostgresQL.



More information about the Python-list mailing list