Add 'extra' parameter to columns and relations

Issue #80 resolved
Former user created an issue

This patch just adds an 'extra' parameters to columns and relations. The purpose of this parameter is to add information to the schema relevant to the automatic generation of interfaces (i.e. validators, help descriptions, etc.)

Comments (2)

  1. Mike Bayer repo owner

    sorry, I have to say no to this one....in Python, it is already a given that you can add attributes to any existing object, so not having the argument there is not preventing anything. There is also a recent addition which I havent documented yet where you can get easy access to a "relation" on an object, or whatever its accessor is, like this:

        m = mapper(myclass, mytable)
    
        p = myclass.myprop.property  # equivalent to m.props['myprop']('myprop')
    
        p.myattribute = 'hi'
    

    secondly, the "spirit" of SA is to be a little more object-oriented than this (even though its Python, I know) and would prefer that applications use OO-style patterns for associating data with an object, rather than modifying the internals of the library to do it...since a single "extra" parameter might work for one particular design, but wouldnt work for 1000 other designs (who need more parameters, parameters in different places, etc.) if you need metadata about interfaces, validators, etc., there should be classes and types dedicated to those concepts, which can then maintain referneces to SQLAlcehmy table, column, and mapper objects.

  2. Log in to comment