Thank you so much. I will try adding base class derived from
declarative base and implement save, update and delete methods.

Regards,

Krish

On Dec 27, 2:19 pm, Serge Koval <serge.ko...@gmail.com> wrote:
> You can always do self.session.add(self) in save() without checks. If
> your model was already associated with the session before, it won't add
> it again.
>
> Here's sample code I use:
>
> def save(self, flush=False):
>     self.session.add(self)
>
>     if flush:
>         self.session.flush()
>
> def delete(self):
>     self.session.delete(self)
>
> Serge.
>
> karikris...@gmail.com wrote:
> > I am using declarative style models and very much happy about it.
>
> > I see __table__ contains the classic sa.Table reference for advanced
> > queries. Like that do we have session is attached to the model class
> > derived from declarative_base?
>
> > I am very much curious to make django/rail style save, update, delete
> > methods on top of sqlalchemy.
>
> > I don't know much  about Exlir but I see it does things over smart
> > matching some ruby like stuff. Not sure about community support.
>
> > If the session is attached, I can say like
>
> > class MyModel(SQLAlchemyDecBase)
> > ...
> >     def save(self):
> >           self.session.add(self)
> >          #or
> >           meta.session.add(self)
>
> > --
>
> > 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 
> > athttp://groups.google.com/group/sqlalchemy?hl=en.

--

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