Re: [SQLObject] mapping DB to legacy python objects
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Charles B. <li...@st...> - 2004-03-25 07:18:53
|
> You might still hit that assertion error, though I'm not quite sure why > -- maybe the leading underscores. You could probably disable that > assertion if that's the case. SQLObject should be a little smarter > about that, and probably put quotes of some sort around the name if it > isn't SQL-safe. Thanks for the responses. I agree that the leading underscores are causing the problems in this case. I checked in SQLBuilder's sqlIdentifier and found that the following re was causing the Assertion: safeSQLRE = re.compile(r'^[a-zA-Z][a-zA-Z0-9_\.]*$') I changed that to safeSQLRE = re.compile(r'^[a-zA-Z0-9_\.]*$') Which worked, but gave me some pretty strange column names: 1/Query : CREATE TABLE sticky_sessions ( id INT PRIMARY KEY AUTO_INCREMENT, _sticky_sessions__remote_address VARCHAR(32), sid VARCHAR(255) NOT NULL UNIQUE, user_id INT, _sticky_sessions__access_time DATETIME, _sticky_sessions__creation_time DATETIME ) I imagine this has something to do with the way the newClass generates the names, but I couldn't quite follow how that is done. Maybe once I progress in my familiarity w/ the code and metaclasses in general. :) For now I think I'll just change the project code I'm trying to adapt to and deal w/ consequences later. Thanks again! -Charles. |