I have a many-to-many schema using an association object and the
association proxy. I'm able to add data via the ORM, but trying to
delete from the association (but not delete the left or right tables)
throws a AssertionError: Dependency rule tried to blank-out primary
key column
tables? If a
parent (Keyphrase or Action) is deleted, then I want the delete to
cascade to the association (KeyphraseAction), but not vice versa.
On Jun 3, 10:26 am, Michael Bayer mike...@zzzcomputing.com wrote:
hollister wrote:
# mappers
mapper(Keyphrase, keyphrase_table)
mapper(Action
I have a simple query with a group_by and count(), and I'd like to
pass this to webhelpers.paginate for display:
def referrers(self):
s = select([m.hit_table.c.id, m.hit_table.c.referer, func.count
(m.Hit.referer).label('count')],
from_obj = [m.hit_table],
Update:
If I run:
results = meta.Session.execute(s).fetchall()
and pass that to paginate, it works.
I guess I just needed the ResultProxy, and not a collection of mapped
objects.
Mike, if you have any additional insight for me, I would appreciate
it.
On Jun 19, 11:30 am, Hollister
The bad news with results = meta.Session.execute(s).fetchall() is
that it runs for every page in the paginator, fetching all rows each
time.
Thoughts, anyone?
On Jun 19, 12:17 pm, Hollister a.hollister.willi...@gmail.com wrote:
Update:
If I run:
results = meta.Session.execute(s
/SQLAlchemy-0.5.2-
py2.6.egg/sqlalchemy/orm/query.py', line 1956 in setup_context
if context.order_by is False and self.mapper.order_by:
AttributeError: 'QueryContext' object has no attribute 'order_by'
On Jun 19, 12:35 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Hollister wrote:
When I run
Ok, I see.
So what's the best way for me to construct and execute this query?
On Jun 19, 1:30 pm, Michael Bayer mike...@zzzcomputing.com wrote:
you can't call count() when you've used from_statement, that should be
raising an error. the bug is that no error is being raised.
Hollister wrote
...@zzzcomputing.com wrote:
Hollister wrote:
Ok, I see.
So what's the best way for me to construct and execute this query?
use Query:
session.query(MyClass.someid,
MyClass.somethingelse).filter(..whatever..).order_by(..whatever...)
On Jun 19, 1:30 pm, Michael Bayer mike...@zzzcomputing.com wrote
I have 2 tables which are related to each other through an M:N
relationship (Keyword Action). Additionally, the relationship itself
has attributes, which I have as non-key attributes in a third table
(KeywordAction). I've modeled this dozens of different ways, but have
yet to get exactly what I
, Hollister wrote:
I have 2 tables which are related to each other through an M:N
relationship (Keyword Action). Additionally, the relationship itself
has attributes, which I have as non-key attributes in a third table
(KeywordAction). I've modeled this dozens of different ways, but have
yet
' on instance
But this does work:
assoc = meta.Session.query(m.KeyphraseAction)\
.filter(and_(m.KeyphraseAction.keyphrase_id == kp.id,
m.KeyphraseAction.action_id == kp.actions[i].action.id))\
.one()
meta.Session.delete(assoc)
What am I doing wrong?
On Aug 5, 3:05 pm, Hollister
Also, the following does nothing at all (does not delete and throws no
errors):
for ka in kp.actions:
del ka
But this:
del kp.actions
Throws the same assertion error.
On Aug 6, 11:01 am, Hollister a.hollister.willi...@gmail.com wrote:
Still having a little trouble...here
I ran into this also and it was caused by forgetting to map the class
to the table.
Make sure you have a line like:
orm.mapper(TaskAction, taskaction_table)
Mike: should there be a more specific error message for a missing
mapping?
-aw
On Feb 3, 11:04 am, Michael Bayer
Ok...maybe I'm missing something, but why wasn't that raised in this
case instead of the rather cryptic exception?
On Feb 18, 4:59 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Feb 18, 2010, at 1:16 PM, Hollister wrote:
I ran into this also and it was caused by forgetting to map
14 matches
Mail list logo