|
From: Scott L. <sle...@in...> - 2003-11-28 22:13:26
|
I'm fairly new to SQLObject and Python for that fact. I've poured over a
few python tutorials and actually read the SQLObject docs. I feel brassy
enough to try a small program but I'm stuck before get started.
Here's what I have installed (all from RPMs):
RedHat 9
python 2.3
SQLObject 5.1
MySQL 3.23.58
MySQL-Python
Here's the code I put together:
from SQLObject import *
_connection_ = MySQLConnection(host="localhost", user="xxxx",
passwd="zzzz", db="ReportDR")
class ProcReport(SQLObject):
_table = "procReport"
#db columns
sourceOrg = StringCol(length=10)
mrn = StringCol(length=10)
lastName = StringCol(length=10)
firstName = StringCol(length=10)
middleName = StringCol(length=10)
dateOfBirth = DateTimeCol(default=None)
gender = StringCol(length=1, default=None)
orderingMd = StringCol(length=20)
procDesc = StringCol(length=20)
srvDateTime = DateTimeCol(default=None)
readingMd = StringCol(length=20)
reportText = StringCol()
reportHtml = StringCol()
reportSource = StringCol()
#create the table
ProcReport.createTable()
When I run this, I get
Traceback (most recent call last):
File "_ProcReport.py", line 33, in ?
ProcReport.createTable()
File "/usr/lib/python2.3/site-packages/SQLObject/SQLObject.py", line
965, in createTable
cls._connection.createTable(cls)
AttributeError: 'NoneType' object has no attribute 'createTable'
Any ideas? I've even tried to run the people.py example from the 5.1
tarball with the following results:
#python2.3 people.py create
Traceback (most recent call last):
File "people.py", line 96, in ?
table.createTable(ifExists=True)
TypeError: createTable() got an unexpected keyword argument 'ifExists'
And the tutorials made it look so darn easy....
--
------------------------------------------------------------------------
Scott LeFevre, Consultant
Solutio Informatio
t: 317/696-1010
|