Hello all,
I'm setting my application up the way Simon suggested. I still use the
table object so I can get its name for displaying in one list, but the
other list (which holds the actual rows of the selected table) is
using the relevant subclass of base.

I use wx.ListCtrl to display everything, and when I load the rows into
their list, I first grab the column names from the table and set the
list to have those columns. Then, I want to itterate over each row,
extracting the value for the given column and displaying it. That's
the problem: these objects are not itterable. I tried to use
value(columnName), but that didn't work, even though the rows are
returned from a query. Here's my attempt thus far.

 def updateSelectedIndex(self, evt):
  """When the index changes in the list of tables, the list of records
is automatically populated with the newly-selected table's records."""
  super(DBTablesListManager, self).updateSelectedIndex(evt)
  self.records_listControl.ClearAll() #to avoid appending items--we
want each table to display only its own data
  table = self.choices[self.selectedIndex][0] #this is the
sql.schema.Table object
  self.records =
DBInterface.session.query(self.schemas[self.selectedIndex]).all()
#self.schema is the list of actual subclasses of base, not table
objects
  #set the column names in the records list
  i = 0
  for column in table.columns:
   self.records_listControl.InsertColumn(i, column.name)
   i += 1
  #add the data
  i = 0
  for record in self.records:
   recordData = record.value(table.columns[i]).__str__() #this line errors
   self.records_listControl.InsertStringItem(i, recordData)
   for j in range(1, len(record)):
    self.records_listControl.SetStringItem(i, j, record[j].__str__())
#this line would fail too
   i += 1

I'm either missing something obvious, or thinking about this all
wrong, because itterating over a row has to be a pretty common need.
Thanks in advance for any suggestions anyone has.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to