[SQLObject] Re: problem: implementing BoolCol
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Nick <ni...@dd...> - 2003-04-30 17:41:46
|
[ earlier discussion about implementing different SQL types and converting them to Python types ] I've been looking at the code for Constraints and Col, and it looks to me like there needs to be a distiction between real constraints (MaxLength, Unique, Not Null, for example) and type checking/casting. It's a little mixed right now. In terms of type checking and conversion, I would propose: 1) make validators part of Col instead of just random functions in Constraints that get referenced in Col. 2) at the rate it's going, there are going to be a lot of parallel _mysql, _postgres, _sqlite, etc. functions for every operation under Col. There needs to be a way to bundle a bunch of functions for the particular db api, probably related to whatever _connection type you're using. 3) for each db api, there needs to be convert-from-result-to-python and convert-from-python-to-sql-value functions as part of the Col class, encapsulated by the mechanism described in 2. I've got some ideas how to do this, but I don't want to go ripping through the code if you're going somewhere else with this. Nick |