Hello everybody,
I've been tearing my hairs out trying to figure out how to achieve the
following.
Base = declarative_base()
class Group(Base):
g_id = Column(Integer, primary_key=True)
events = relationship('Event', backref='group', lazy='dynamic')
class
On Jul 28, 2013, at 9:29 AM, askel dummy...@mail.ru wrote:
What I have ended up with is the following:
class Group(Base):
events = relationship('Event', lazy=True)
session.query(Group).join(Group.events).options(contains_eager(Group.events).filter(Event.e_date=='2013-01-01')
The
Thanks for the reply. I'll stick with *contains_eager* solution as per your
advice. That *bindparam* trick would work in this particular case too but I
like flexibility of using former solution.
- alex
On Sunday, July 28, 2013 11:50:29 AM UTC-4, Michael Bayer wrote:
On Jul 28, 2013, at 9:29
Hi,
I want to establish a relationship with an object whose key is defined
inside a JSON BLOB column in the child. Naively, I know I can do this
via a regular python @property that uses object_session() to then do a
query() using the id from inside the blob. Is there a better way that
lets
Using a BLOB as a key is a really bad idea and wont work on all backends, but
other than the database-level limitations inherent, SQLAlchemy will let you set
up whatever column you'd like to use as the key just fine within a
relationship(). Guessing what the problem might be. Foreign key ?
I'm not intending for the contents of the BLOB to be readable to
MySQL. It would only be cracked open and read from within Python.
Meaning Python only knows what the key actually is. So yeah, I
understand the caveats of this approach. I merely want to provide a
mechanism to, as a second
On Thu, Jun 2, 2011 at 5:18 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Jun 2, 2011, at 8:11 PM, Ben Chess wrote:
I'm not intending for the contents of the BLOB to be readable to
MySQL. It would only be cracked open and read from within Python.
Meaning Python only knows what the
On Jun 2, 2011, at 8:25 PM, Ben Chess wrote:
On Thu, Jun 2, 2011 at 5:18 PM, Michael Bayer mike...@zzzcomputing.com
wrote:
On Jun 2, 2011, at 8:11 PM, Ben Chess wrote:
I'm not intending for the contents of the BLOB to be readable to
MySQL. It would only be cracked open and read from
Sounds far more complicated than something I'd want to take on.
Thanks for your thoughts and the detailed response.
Ben
On Thu, Jun 2, 2011 at 6:28 PM, Michael Bayer mike...@zzzcomputing.com wrote:
On Jun 2, 2011, at 8:25 PM, Ben Chess wrote:
On Thu, Jun 2, 2011 at 5:18 PM, Michael Bayer