Re: [sqlalchemy] Using `INSERT...ON CONFLICT` with ORM

2017-02-17 Thread Calvin Young
Michael, Thanks for the quick response. In this example, `bar` is *not* the primary key, so I guess using the ORM here would be out of the question. What's your recommendation for refreshing the `foo` object after executing the `session.execute(do_update_stmt)` statement? Should I do an

Re: [sqlalchemy] ORM: Implementing abstract base class that generates auxiliary tables for each child class

2017-02-17 Thread Simon King
On Fri, Feb 17, 2017 at 10:03 AM, wrote: > I want to achieve something like this: > > Base = declarative_base() > > # the abstract base, no table generated for it > class TreeNode(Base): > __abstract__ = True > parent = Column(ForeignKey('child_class_table.id'),

[sqlalchemy] ORM: Implementing abstract base class that generates auxiliary tables for each child class

2017-02-17 Thread linlycode
I want to achieve something like this: Base = declarative_base() # the abstract base, no table generated for it class TreeNode(Base): __abstract__ = True parent = Column(ForeignKey('child_class_table.id'), nullable=False) def is_root(self): pass def get_parent(self): pass # more methods #