Christopher, 

> 
> Try reading this whole section part of the SQLObject documentation:
> http://sqlobject.org/SQLObject.html#legacy-database-schemas
> """
> All tables that you want to turn into a class need to have an integer 
> primary key.
> [...]
> By default names in SQLObject are expected to be mixed case in Python 
> (like mixedCase), and underscore-separated in SQL (like mixed_case). 
> This applies to table and column names.
> The primary key is assumed to be simply id.
> [...]
> If you use non-integer keys, all primary key management is up to you.
> """
> This seems to be the stuff you're running into.
> 
> By default, name mangling is used; case transitions in Python (like 
> 'empID') are converted to lower case with underscores in SQL (like 
> 'emp_id')... sounds like fromDatabase=True is helping you get around 
> this though.
> 
> SQLObject expects tbl_acct_prefs to have a column named 'id' 
> that's an integer primary key - sounds like you don't have that.  It's 
> easy if you have an integer primary key named something else (just set 
> sqlmeta.idName), but if you don't have that it's kind of a 
> dealbreaker.

Well, that sucks. I really like the way SQLObject works, but SQLAlchemy is
a good alternative too. Unfortunately, our organization has a lot of
databases from various vendors that we can't change willy-nilly, so the
primary keys can be whatever they want them to be. Of course, there are
quite a few tables that don't even have primary keys. So I guess this
won't work...


> 
> If you're just learning how to use SQLObject, I'd recommend that you 
> start with an empty database created & managed entirely by a SQLObject 
> app, if possible.
> 
> Good luck,
> cs
> 

I have been playing in my own sandbox using examples from a couple of
books that use SQLObject in TurboGears. I think I'll have to change to
SQLAlchemy though. I played with it a couple of weeks ago and it doesn't
have this primary key requirement.

Thanks for the help!

Mike

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to