[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-db-sig
Subject:    [DB-SIG]  Python db programming conventions
From:       python + sqlite3 <sqlite3.user () gmail ! com>
Date:       2010-10-16 7:08:14
Message-ID: 29977345.post () talk ! nabble ! com
[Download RAW message or body]


Hello all,

As I'm new to both python and sqlite3, I would like to consult regarding
python db programming conventions. After I finished to design my application
and started coding it, I found myself dealing with the following questions:

1. Since the db contains more than one table, it seems natural to use
transaction in order to create the it. The transaction contains more than
one SQL statement and therefor can't be executed using cursor.execute(). I
found the method cursor.executescript() that documented as non-standard, is
that the method to be used? is there better way of creating the db?

2. In order to create and maintain the db tables, I'll need to use several
long transactions (CREATE, EDIT, INSERT, DELETE etc.). Where should I place
the SQL code for them? Should my class contain the SQL queries as private
string properties? should I define the SQL queries as class member
functions? Or is it better to store the SQL code in separate SQL files and
execute the files somehow (is it possible to execute SQL file using
sqlite3)?

I'd appreciate your help,
Cheers
-- 
View this message in context: \
http://old.nabble.com/Python-db-programming-conventions-tp29977345p29977345.html Sent \
from the Python - db-sig mailing list archive at Nabble.com.

_______________________________________________
DB-SIG maillist  -  DB-SIG@python.org
http://mail.python.org/mailman/listinfo/db-sig


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic