SQLObject

ChrisW c.c.wood at gmail.com
Mon Sep 28 14:40:53 EDT 2009


I'm new to using SQLObject, and having some problems with getting it
to recognise my current MySQL database.

I've set up my connection fine, but it won't recognise the names of
the columns (presumably because they're not written using the default
naming convention?).  For example, one of my columns is an acronym, so
is 3 uppercase letters.  I've tried the following:

class Table1(sqlobject.SQLObject):
  _connection = conn
  _fromDatabase = True

  class sqlmeta:
     table = 'Table1'
     idName = 'Table1ID'

  BOB = StringCol()

print Table1.get(1)

this gives the result

Unknown column 'bo_b' in 'field list'

So, specifically a few questions:

I've seen the attribute in class sqlmeta of 'columns' - will this find
my column names automatically, or do I still need to input them
manually? If the latter..:

I assume I set the names of each column in the instance of sqlmeta
(like I have done with the table name) - how do I do this?! Do I do
this before or after I've told SQLObject that the BOB column is a
String column?

Is there a published list of the default naming convention that
SQLObject follows? I couldn't find it on the website.

Thanks in advance for any help anyone is able to give.

Chris



More information about the Python-list mailing list