Is there a way to access the changed attributes of an ORM object ?
Everything I've dug up refers to the dirty objects in a session, not the
attributes of an object.
( I'm trying to automate some revision logging /auditing of sqlalchemy
objects )
--
You received this message because you
http://docs.sqlalchemy.org/en/rel_0_8/orm/internals.html#sqlalchemy.orm.state.AttributeState
On Aug 12, 2013, at 12:48 PM, Jonathan Vanasco jvana...@gmail.com wrote:
Is there a way to access the changed attributes of an ORM object ?
Everything I've dug up refers to the dirty objects in a
there's a typo in the docs:
bad:
attr_state = insp.attr.some_attribute
works:
attr_state = insp.attrs.some_attribute
--
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To unsubscribe from this group and stop receiving emails from it, send an
Thanks Michael!
On Sunday, August 11, 2013 4:33:20 PM UTC-4, Michael Bayer wrote:
On Aug 11, 2013, at 3:06 PM, csd...@gmail.com javascript: wrote:
I'm having problem with the following code which is designed to remove an
object identified as malformed prior to session.commit():
if
Thanks, Mike!
That let me slap together a quick mixin class to store versioned data (of
specific columns) in PostgreSQL -
class RevisionObject(object):
revision_columns = None
revision_id = sa.Column(sa.Integer, nullable=False, default=0 )
revision_history = sa.Column(
Hello everyone,
this is more of a code architecture and design question but I'm wondering
what the best practices are regarding declarative models. On the one
extreme, models are pretty barebone, with little more than the columns,
relationships and possibly a few declared attributes and
On 08/12/2013 02:50 PM, George Sakkis wrote:
Hello everyone,
this is more of a code architecture and design question but I'm
wondering what the best practices are regarding declarative models. On
the one extreme, models are pretty barebone, with little more than the
columns, relationships
Just for a bit of perspective...
My SqlAlchemy integration for a project is connected to two distinct
applications :
- Pyramid -- Web Application
- Celery -- Background Processing
We're also hoping to get it working on a third
- Twisted -- More Background Work
There are a lot of moving parts
I have another question about a piece of code that I posted the other day.
Namely, I have a one-to-many relationship between Creator and Company. A
Creator can have a relationship with multiple Companies but any one Company
can have a relationship with only one Creator.
class Company(Base):
In `Company.__init__()`, instead of blindly creating a new `Creator` instance,
you need to first query for an existing Creator with that name. If it exists,
append it, otherwise, create a new one and append that.
--
Tim Van Steenburgh
On Monday, August 12, 2013 at 9:26 PM, csdr...@gmail.com
Sorry I don't understand what you're trying to say.
If the Creator already exists, and I'm to append it again, isn't that the
same as what my code is currently doing? (That is, appending in every
instance.) I don't see how this wouldn't result in the same error message.
And what would it mean
It's not the append that's causing the error, it's the fact that you're
creating a new Creator() instance, which ultimately results in an INSERT
statement being issued.
You want to append a Creator instance to `company.creator`, but you don't
necessarily want to make a new Creator every time
Sorry, that should have been:
existing_creator = DBSession(Creator).query.filter_by(creator=creator).first()
On Monday, August 12, 2013 at 9:49 PM, Tim Van Steenburgh wrote:
It's not the append that's causing the error, it's the fact that you're
creating a new Creator() instance, which
Ad, one more try:
existing_creator = DBSession.query(Creator).filter_by(name=creator).first()
--
Tim Van Steenburgh
On Monday, August 12, 2013 at 9:50 PM, Tim Van Steenburgh wrote:
Sorry, that should have been:
existing_creator =
Very helpful, thanks Tim :)
On Monday, August 12, 2013 9:53:48 PM UTC-4, Tim wrote:
Ad, one more try:
existing_creator = DBSession.query(Creator).filter_by(name=creator).first()
--
Tim Van Steenburgh
On Monday, August 12, 2013 at 9:50 PM, Tim Van Steenburgh wrote:
Sorry, that
15 matches
Mail list logo