On Wed, Apr 21, 2010 at 6:35 AM, Michael Bayer <mike...@zzzcomputing.com> wrote:
> Rhett Garber wrote:
>> This would be much easier, I could potentially be what we go with. I
>> think this is similar to my 'original implementation'
>> I just found the syntax to be a bit bothersome since the person
>> creating the table has to know they are creating two
>> columns... or not using declarative. These ids are (and foreign keys)
>> mean you'll be doing something like this multiple
>> times on every table in our system, so I want it to be a streamline
>> and foolproof as possible.
>
> It hasn't gotten across to me what the "two columns" version of this is.
> an illustration of the table schema and mappings for that might make it
> clearer what you are attempting.

Oh right, sorry:

class Advertiser(Base):
    __tablename__ = "advertiser"
    id, _id = build_id_column('id', primary_key=True)
    salesperson_id, _salesperson_id =
build_id_column('salesperson_id', foreign_key=ForeignKey("%s.id" %
Salesperson.__tablename__))
    salesperson, _salesperson = build_relation(Salesperson)

Where these build_* functions are returning tuple where the first
element is a synonym for the second, which some extra descriptor stuff
on it
to do the obfuscation.

I think we've also got a version that uses a metaclass to cleanup the
syntax, where it goes through and redefines them for you.
But still, it's pretty complex.

I'm not quite sure I have my head around what's different than your
solution, except this is trying to use declarative syntax.
Perhaps that's the problem.

Rhett

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to