On 6/13/07, Marco Mariani <[EMAIL PROTECTED]> wrote:
>
> Roger Demetrescu ha scritto:
>
> > query.get(dict(columnB='foo', columnA='bar')
> >
> > Lazy programmers are the best ones...  :)
> >
>
> That's the reason lazy programmers share a superclass for all their
> domain objects... hint, hint :-)

Yeaph, I totally agree..  :)

But notice that this feature is related to SA's Query class, and not
my domain objects...
Unless I do something like (if it is possible at all):

<pseudo code>

class BaseClass(object)
    @staticmethod
    def give_me_pk_values_in_correct_order(self, **kw):
      table = <don't know how to retrieve the correct table object>
      return [kw[c.key] for c in table.primary_key]

class Customer(BaseClass): pass

</pseudo code>


But the use of this function is to ugly to my taste (I know, the
"give_me_pk_values_in_correct_order" is too big here):

customer = 
session.query(Customer).get(Customer.give_me_pk_values_in_correct_order(dict(columnX=3,
columnY=4, columnZ=343))

Having to repeat Customer reference twic annoys me...  :)


Or am I missing a better way of doing this ?


Cheers,

Roger



>
>
> >
>

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

Reply via email to