On 26 май, 20:50, Michael Bayer mike...@zzzcomputing.com wrote:
However, its quite easy to achieve. Just use this.
class LimitingQuery(Query):
def get(self, ident):
return Query.get(self.populate_existing(), ident)
def __iter__(self):
return
On 27 май, 18:22, Michael Bayer mike...@zzzcomputing.com wrote:
On May 27, 2009, at 4:25 AM, Denis S. Otkidach wrote:
class LimitingQuery(Query):
def get(self, ident):
return Query.get(self.populate_existing(), ident)
def __iter__(self):
return Query.__iter__
On 26 май, 18:24, Michael Bayer mike...@zzzcomputing.com wrote:
Denis S. Otkidach wrote:
such ability in SQLAlchemy. There is a suggestion (
http://groups.google.com/group/sqlalchemy/browse_thread/thread/bcd10e...
) to provide custom query_cls. This probably worked a year ago
I use declarative to define database scheme, and binds parameter to
session constructed from several metadata tables lists. And I have a
problem with inherited models, where table is represented as Join
object: get_bind() method doesn't find an engine. A quick-n-dirty
solution I use is:
class
On Mon, Mar 3, 2008 at 8:23 PM, Michael Bayer [EMAIL PROTECTED] wrote:
We define __eq__() all over the place so that would be a lot of
__hash__() methods to add, all of which return id(self). I wonder if
we shouldn't just make a util.Mixin called Hashable so that we can
centralize the
On Jan 15, 2008 6:54 PM, Michael Bayer [EMAIL PROTECTED] wrote:
The last commit fails with:
sqlalchemy.exceptions.IntegrityError: (IntegrityError)
Referers.objectId may not be NULL u'UPDATE Referers SET objectId=?
WHERE Referers.id = ?' [None, 1]
right thats because the instance doesnt
On Jan 11, 2008 8:41 PM, Michael Bayer [EMAIL PROTECTED] wrote:
what that looks like to me is that you're attempting to query the
database for object ID #1 using merge().
when you merge(), its going to treat the object similarly to how it
does using session.save_or_update(). that is, it
On Jan 11, 2008 7:57 PM, Jonathan LaCour [EMAIL PROTECTED] wrote:
Jonathan LaCour wrote:
I am attempting to model a doubly-linked list, as follows:
... seems to do the trick. I had tried using backref's earlier,
but it was failing because I was specifying a remote_side
keyword
On Dec 28, 2007 6:25 PM, Michael Bayer [EMAIL PROTECTED] wrote:
On Dec 28, 2007, at 5:50 AM, Denis S. Otkidach wrote:
Sure, I can get an object from DB and copy data from new one. But
there is a lot of object types, so have to invent yet another meta
description for it (while it already
On Dec 28, 2007 1:00 AM, Rick Morrison [EMAIL PROTECTED] wrote:
Here's the idiom that should work:
def ensure_object(sess, id):
o = sess.Query(ModelObject).get(id)# if found, o is now loaded into
session
if not o:
o = ModelObject(1, u'title')
sess.save(o)
On Dec 26, 2007 10:38 PM, Michael Bayer [EMAIL PROTECTED] wrote:
if you have an instance which you are unsure if it already exists, you
can add it to a session using session.save_or_update(instance). The
decision between INSERT and UPDATE is ultimately decided by the
presence of an attribute
The following code fails on the last assert statement (SQLAlchemy
0.4.1):
---8---
from __future__ import with_statement
import sqlalchemy as sa, logging
from sqlalchemy.orm import mapper, sessionmaker
logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO)
logging.basicConfig()
class
On Dec 26, 2007 6:29 PM, Michael Bayer [EMAIL PROTECTED] wrote:
yet another scenario, you want to use transactions that are
independent of session flushes. To accomplish this, use engine- or
connection-level transactions, as described in the second half of
13 matches
Mail list logo