On Aug 23, 2008, at 1:56 PM, Rob wrote:
Hi,
I'm using sqlalchemy 0.5 beta 3 and I am trying to have a Call object
that contains two relations to a Contact object. One is the callee
and the other is the caller. The code is as follows:
from sqlalchemy.ext.declarative import
Hi,
You're right:
mapper(Call, call_table, properties={
'callee':relation(Contact,
primaryjoin=call_table.c.callee_id==contact_table.c.id,
backref='callee_calls'),
'caller':relation(Contact,
primaryjoin=call_table.c.caller_id==contact_table.c.id,
backref='caller_calls')
On Jul 20, 11:57 pm, Sean Davis [EMAIL PROTECTED] wrote:
I have a table that has two columns that reference the same table in a
foreign-key relationship. What do I need to specify and where to
avoid the error below?
class 'sqlalchemy.exceptions.ArgumentError': Error determining
primary
Excellent, that (expire, refresh) works. Thank-you very much.
Is there a reason why it sometimes works?
On Feb 20, 11:47 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Feb 20, 2007, at 12:01 PM, Ali wrote:
u = User(name='Ali')
u.flush()
r = Receipt(user_id=u.id)
r.flush()
r.user is
the cancelled_user may not have been lazy loaded before you flush()
ed.
On Feb 21, 2007, at 6:09 AM, Ali wrote:
Excellent, that (expire, refresh) works. Thank-you very much.
Is there a reason why it sometimes works?
On Feb 20, 11:47 pm, Michael Bayer [EMAIL PROTECTED] wrote:
On Feb 20,
On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED] wrote:
Here is my code (with other fields removed):
stockreceipt_table = Table('stockreceipt', meta,
Column('user_id', Integer, ForeignKey('user.id')),
# Cancellation
Column('cancelled_user_id', Integer, ForeignKey('user.id')),
)
I left out the fields for brevity of example. They both have an id
column defined as primary keys.
On 20 Feb, 17:11, Michael Bayer [EMAIL PROTECTED] wrote:
On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED] wrote:
Here is my code (with other fields removed):
stockreceipt_table =
By both, I mean user and receipt tables
On 20 Feb, 17:12, Ali [EMAIL PROTECTED] wrote:
I left out the fields for brevity of example. They both have an id
column defined as primary keys.
On 20 Feb, 17:11, Michael Bayer [EMAIL PROTECTED] wrote:
On Feb 20, 12:01 pm, Ali [EMAIL PROTECTED]
Ok,
from sqlalchemy import *
from sqlalchemy.ext.assignmapper import assign_mapper
from sqlalchemy.ext.sessioncontext import SessionContext
meta = DynamicMetaData()
ctx = SessionContext(create_session)
def make_engine(uri=None):
if uri is None:
uri = 'sqlite:///:memory:'
well I cant run the program since its not complete (no Drug, Supplier
class/tables defined, etc), but if id hazard a guess id say you
shouldnt be calling flush() on your class instances, since it will
not flush any changes on any dependencies. call ctx.current.flush()
instead.
On Feb
Thanks for the advice, and sorry I didn't provide the correct
information, but ctx.current.flush() makes no difference.
r.cancelled_user is (nearly: 19/20) always None immediately after the
assign and flush with no database access being made. Interestingly,
the user_id/user relationship is always
11 matches
Mail list logo