Database vs Data Structure?

Scott David Daniels Scott.Daniels at Acm.Org
Sat Apr 19 14:27:20 EDT 2008


castironpi at gmail.com wrote:
> On Apr 18, 12:23 am, I V <ivle... at gmail.com> wrote:
>> On Thu, 17 Apr 2008 19:30:33 -0700, erikcw wrote:
>>> use some sort of data-structure (maybe
>>> nested dictionaries or a custom class) and store the pickled
>>> data-structure in a single row in the database (then unpickle the data
>>> and query in memory).
>> Why would you want to do this? I don't see what you would hope to gain by
>> doing this, over just using a database.
> 
> Are databases truly another language from Python, fundamentally?

Yes.  A fair amount of study went into them.  Databases are about
information that survives the over an extended period of time (months
or years, not hours).

Classic qualities for a database that don't normally apply to Python
(all properties of a "transaction" -- bundled set of changes):
     * Atomicity:
        A transaction either is fully applied or not applied at all.
     * Consistency:
        Transactions applied to a database with invariants preserve
        those invariants (things like balance sheets totals).
     * Isolation:
        Each transactions happens as if it were happening at its own
        moment in time -- tou don't worry about other transactions
        interleaved with your transaction.
     * Durability:
        Once a transaction actually makes it into the database, it stays
        there and doesn't magically fail a long time later.

-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list