On Wed, May 22, 2019, at 2:09 PM, Tony Cao wrote:
> Sorry, I will clarify what I was asking. If I had my class example from above:
>
> class A(Base):
> foo = Column(String)
> bar = Column(String)
> foo_updated = Column(DateTime, onupdate=update_fn) # Should only update when
> foo is updated
Sorry, I will clarify what I was asking. If I had my class example from
above:
class A(Base):
foo = Column(String)
bar = Column(String)
foo_updated = Column(DateTime, onupdate=update_fn) # Should only update
when foo is updated
Based on what information is in the context, sometimes
On Thu, May 16, 2019 at 4:26 PM Tony Cao wrote:
>
> Ohh I see thanks for the help!
>
> And just to confirm on the onupdate front, is it not possible to return the
> current value of the object being updated? It's ok to emit an extraneous
> update if the value doesn't change.
inside the
Ohh I see thanks for the help!
And just to confirm on the onupdate front, is it not possible to return the
current value of the object being updated? It's ok to emit an extraneous
update if the value doesn't change.
On Wednesday, May 15, 2019 at 5:30:06 PM UTC-7, Mike Bayer wrote:
>
> On Wed,
On Wed, May 15, 2019 at 6:10 PM Tony Cao wrote:
>
> I mean query.update().
>
> Ah our goal was to make it so the update in question happened automatically
> without the developer having to explicitly specify it - in that case both
> obj.attr = x and obj_class.query.update({obj.attr: x}) should
I mean query.update().
Ah our goal was to make it so the update in question happened automatically
without the developer having to explicitly specify it - in that case both
obj.attr = x and obj_class.query.update({obj.attr: x}) should both trigger
an update to obj.attr_modified. That's why I
Bulk query updates, you mean, query.update() ? Or
session.bulk_update_mappings() ?In both cases you are
programatically providing the VALUES clause, so you know from your own
data what the UPDATE statement will be.
On Wed, May 15, 2019 at 4:14 PM Tony Cao wrote:
>
> Ah but it also looks
Ah but it also looks like the before_update event isn't triggered when
doing bulk query updates, which we'd like to also update on. Is there a way
to track those?
On Wednesday, May 15, 2019 at 10:38:24 AM UTC-7, Mike Bayer wrote:
>
> you can inspect() the object and look at
>
you can inspect() the object and look at inspect(obj).attrs['some_attr'].history
https://docs.sqlalchemy.org/en/13/orm/internals.html#sqlalchemy.orm.state.AttributeState
On Wed, May 15, 2019 at 1:14 PM Tony Cao wrote:
>
> Hi,
>
> Thanks for the response! I also tried looking into
Hi,
Thanks for the response! I also tried looking into before_update, but is
there a recommended way to figure out what columns are being updated from
that event? I had found this post (
On Mon, May 13, 2019 at 4:18 PM Tony Cao wrote:
>
> Hi all,
>
> Is there way to use Column.onupdate conditionally? For example, say I have:
>
> class A(Base):
> foo = Column(String)
> bar = Column(String)
> foo_updated = Column(DateTime, onupdate=update_fn) # Should only update
>
Hi all,
Is there way to use Column.onupdate conditionally? For example, say I have:
class A(Base):
foo = Column(String)
bar = Column(String)
foo_updated = Column(DateTime, onupdate=update_fn) # Should only update
when foo is updated
def update_fn(context):
if ...: # How can I
12 matches
Mail list logo