Ordering records

34 views
Skip to first unread message

jason

unread,
Feb 21, 2011, 12:24:30 AM2/21/11
to PyDbLite
Is there any way to change the order in which records are displayed?
For example, I want the following records:

City Buenos Aires
Fax (1) 135-4892
CompanyName Cactus Comidas para llevar
Country Argentina
Address Cerrito 333
Phone (1) 135-5555
__id__ 10
Postal Code 1010
__version__ 0
CustomerID CACTU

to be displayed this way (the order of the database fields for my
project):

CustomerID CACTU
CompanyName Cactus Comidas para llevar
Address Cerrito 333
City Buenos Aires
Country Argentina
Postal Code 1010
Fax (1) 135-4892
Phone (1) 135-5555
__id__ 10
__version__ 0

Pierre Quentel

unread,
Feb 21, 2011, 4:33:38 AM2/21/11
to PyDbLite
Hi,

db.fields is the list of fields in the same order as when the db was
created :

for f in db.fields+['__id__','__version']:
print f,record[f]

- Pierre
Reply all
Reply to author
Forward
0 new messages