Changeset 5655

Show
Ignore:
Timestamp:
11/03/08 17:43:38 (2 months ago)
Author:
mramm
Message:

More transaction.commit() explanation, this time for the initializeDB.py script.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • docs/2.0/docs/main/Wiki20/wiki20.rst

    r5654 r5655  
    309309 
    310310Before you can use your database, you need to initialize it and add some data. 
    311 The easiest way to do this is just to run a Python script. Create a file called 
     311There's some built in support for this in TurboGears, but one of the easiest ways to do this is just to run a standard Python script. Create a file called 
    312312**initializeDB.py** in the ``Wiki-20`` directory containing the following: 
    313313  
    314314 
    315315.. code:: wiki_root/trunk/initializeDB.py 
     316 
     317If you're familiar with SQLAlchemy this should look pretty standard to you.  The only part that's different is that we use:: 
     318 
     319transaction.commit() 
     320 
     321where you're used to seeing ``Session.commit()`` we use ``transaction.commit`` this calls the transaction manager which helps us to support cross database transactions, as well as transactions in non relational databases, but ultimately in the case of SQLAlchemy it calls Session.commit() just like might if you were doing it directly.  
    316322 
    317323Now run the program from the ``Wiki-20`` directory: