2008/9/5 Gaetan de Menten <[EMAIL PROTECTED]>:
> You can't add columns in an autoloaded entity, so far. I never thought
> about this precise use case of only adding aliases to existing
> columns. Could you add a ticket in Elixir trac to this effect?
> thanks...

Actually it works with using_table_options(autoload=True) as opposed
to using_options(..., autoload=True). So yeah it wouldn't have worked
in my previous example, even without the mixin.



class Contact(Entity):
    using_options(tablename='users')
    using_table_options(autoload=True)

    full_name = Field(Text, colname='fullName')

setup_all()

contact = Contact.query.first()
print contact.full_name



This works as expected.

>> class ContactMixin(object):
>>    full_name = Field(Text, colname='fullName')
>>    @property
>>    def pretty_name(self):
>>        return "***" + self.fullName + "***"
>> (...)
>
> And you can't add columns in a Mixin... I've never

OK.

> If you go down the deferred path, you might want to look into deferred groups.

Yes, my idea is to provide a way to pass a list of columns and build a
deferred group containing all the columns except the ones specified.

> To be honest, if you only use autoloaded tables, you'd probably have
> more luck with SQLAlchemy's built-in declarative extension.

Oh, I haven't though of that, thanks for the advice.

All the best,
Alex

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

Reply via email to