Hi!
I have two models
class DB_Object(Base):
__tablename__ = 'objects'
id = Column(Integer, primary_key=True)
name = Column(String(50), unique=True, nullable=False)
type = Column(String(50), default="object")
__mapper_args__ = { 'polymorphic_identity': 'object', 'polymorphi
In the documentation for *session.merge()* method, there is a section on
the mechanism of reconciling if the *load=true* is set:
> If the load=True flag is left at its default, this copy process emits
> events and will load the target object’s unloaded collections for each
> attribute present o
fabulous, this works great. thanks!
now I've got something like this in my code:
def delete_cascade_preview(instance):
keys = [rel.key for rel in inspect(instance.__class__).relationships if
rel.cascade.delete == True]
return {key:getattr(instance, key).all() for key in keys if
getattr(
I'd look at inspect(MyClass).relationships to see where the linkages are to
other classes. Then you can probe those for the features you need - once you
have one, it has a string "key". you can then see that by just
getattr(someobj, "somekey").
On Jul 15, 2014, at 3:40 PM, Scott Meisburger
I've got an app where through an admin interface, a user can delete objects
in the database. This happens via:
db.session.delete(obj)
db.session.commit()
There are cascade rules defined in Python for these objects (using the
ORM). What I want to do is display to the user a list of related objec
On Jul 15, 2014, at 1:56 PM, Mariano Mara wrote:
>
> But actually I don't want to lose track of the relation between parent and
> child. Of course, the easiest solution would be to perform the update in the
> ORM step but I have to use a common class to handle all ORM actions and I
> have to
2014-07-15 14:47 GMT-03:00 Michael Bayer :
>
> On Jul 15, 2014, at 1:27 PM, Mariano Mara wrote:
>
> > Hi all
> >
> > Each time my Parent class is edited and one of the elements from its
> Child relationship is removed I want to "invalidate" this element (e.g.
> element.valid=False) instead of act
On Jul 15, 2014, at 1:27 PM, Mariano Mara wrote:
> Hi all
>
> Each time my Parent class is edited and one of the elements from its Child
> relationship is removed I want to "invalidate" this element (e.g.
> element.valid=False) instead of actually performing the delete DML
> instruction. How
Hi all
Each time my Parent class is edited and one of the elements from its Child
relationship is removed I want to "invalidate" this element (e.g.
element.valid=False) instead of actually performing the delete DML
instruction. How can I achieve that?
I have created a "remove" event listener and
I'm using Flask-SQLAlchemy and flask on server side. I want to create a
relationship between User(Parent), Category(Child) and item(Subchild). I
don't know if a parent-child-subchild is right way to approach this but my
end goal is to easily fetch all the items rated by user in each category.
F
On Tue, Jul 15, 2014 at 3:09 PM, Calvin Chen wrote:
> Hi,
>
> I try to create a 'UserFavoriteTopic' table in sqlachemy that uses 'user_id'
> and 'topic_id' as primary key(unique togher).
>
> How should I implement this? Any suggestions would be appreciated.
>
> My current implementation:
> ===
Hi,
I try to create a 'UserFavoriteTopic' table in sqlachemy that uses
'user_id' and 'topic_id' as primary key(unique togher).
How should I implement this? Any suggestions would be appreciated.
My current implementation:
===
class TopicFavorite(d
12 matches
Mail list logo