Io di solito uso SQLObject, ma io non l'ho usato in condizioni altamente stressanti, così non ho potuto garantire per le prestazioni (Detto questo, io non parlerei contro esso).
Per copiare un codice demo da un'altra risposta:
from sqlobject import *
# Replace this with the URI for your actual database
connection = connectionForURI('mysql://server:XXXX')
sqlhub.processConnection = connection
# This defines the columns for your database table. See SQLObject docs for how it
# does its conversions for class attributes <-> database columns (underscores to camel
# case, generally)
class Song(SQLObject):
name = StringCol()
artist = StringCol()
album = StringCol()
# Create fake data for demo - this is not needed for the real thing
def MakeFakeDB():
Song.createTable()
s1 = Song(name="B Song",
artist="Artist1",
album="Album1")
s2 = Song(name="A Song",
artist="Artist2",
album="Album2")
def Main():
# This is an iterable, not a list
all_songs = Song.select().orderBy(Song.q.name)
# Do something by iterating over the song list...