Re: [sqlalchemy] Problem with Association Object mapping

2012-07-10 Thread Jules Stevenson
Seems I got the append wrong, the below works fine, thanks again for your help. due_con.due_user = c.user contact.due_dates.append(due_con) On Tue, Jul 10, 2012 at 8:46 AM, Jules Stevenson droolz...@googlemail.comwrote: Hi Michael, Yes, I am doing this: due_con

[sqlalchemy] Problem with Association Object mapping

2012-07-09 Thread Jules Stevenson
Hi All, I'm trying to put together an Association Object mapping within a pylons app, but am getting the following error: OperationalError: (OperationalError) (1364, Field 'user_id' doesn't have a default value) 'INSERT INTO contact_duedate_user_association (contact_id, modded) VALUES (%s, %s)'

[sqlalchemy] Querying multiple classes and ordering the results

2011-10-25 Thread Jules Stevenson
Hi All, I'm trying to query more than one class at the same time, and order the result by date (both classes have a .date property), using the following query: c.items = meta.Session.query(model.ArkEmail, model.ArkNote).\ filter(model.ArkEmail.is_thread_parent == True).\

Re: [sqlalchemy] mapping a class linked with two other classes (AttributeError: 'str' object has no attribute '_sa_instance_state')

2011-06-16 Thread Jules Stevenson
, but don't know how... Many thanks, Jules On Thu, Jun 16, 2011 at 2:04 PM, King Simon-NFHD78 simon.k...@motorolasolutions.com wrote: -Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of Jules Stevenson Sent: 16 June 2011 08:44

Re: [sqlalchemy] mapping a class linked with two other classes (AttributeError: 'str' object has no attribute '_sa_instance_state')

2011-06-16 Thread Jules Stevenson
Ack, ignore :). There was no direct relationship to the user at all, doh. So I'm passing that into the ArkUserContactGUID construction, and all works well. Thanks again for the help, much appreciated. Jules -- You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: Trying to query a relationship of a relationship

2011-06-09 Thread Jules Stevenson
fundamental, but I'm not sure what. Any pointers gratefully received. Many thanks, Jules On Wed, Jun 8, 2011 at 9:56 PM, Jules Stevenson droolz...@googlemail.com wrote: sorry, hit the send button a little too soon. Any help on the above much appreciated, Jules -- You received this message

[sqlalchemy] Re: Trying to query a relationship of a relationship

2011-06-09 Thread Jules Stevenson
(ArkInvoice.project.client.id == id) On Thu, Jun 9, 2011 at 8:50 AM, Jules Stevenson droolz...@googlemail.com wrote: I don't think the info I sent last night was particularly clear, apologies it was late. The code for the classes is below: # ArkClient - clientprojectshot module orm.mapper

[sqlalchemy] Trying to query a relationship of a relationship

2011-06-08 Thread Jules Stevenson
Hi List, I'm inexperienced with DBs so please bear with me. I would like to return a list of all invoices that are assigned to a specific client. However the relationships are built so that an invoice has a foreign key to a project, which in turn has a foreign key to a client: Invoice.project

[sqlalchemy] Re: Trying to query a relationship of a relationship

2011-06-08 Thread Jules Stevenson
sorry, hit the send button a little too soon. Any help on the above much appreciated, Jules -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send

Re: [sqlalchemy] Problem with Joined Table inheritance

2010-07-13 Thread Jules Stevenson
Thankyou all, makes sense. foolishly I was looking at the 5.8.0 docs which don;t include the example classes, but should have worked it out regardless. Thanks again, Jules On Tue, Jul 13, 2010 at 3:18 PM, Stefano Bartaletti stefano.bartale...@gmail.com wrote: class ArkWebVideoWidget(object):

[sqlalchemy] Threading and session

2010-01-12 Thread Jules Stevenson
Hi List, I've been trying to work out exactly how I can safely use the session object in a threaded application. I've read the session docs, and posts such as this one: http://mail.google.com/mail/#search/label%3Asqlalchemy+session+threading/1259f8c18a4d2578 But I am struggling a little, but I

Re: [sqlalchemy] Threading and session

2010-01-12 Thread Jules Stevenson
most likely.  when a thread in your queue gets a hold of a new object, merge() it into the local session, using the returned object.   or when you put objects on the queue, expunge() them from their source session first.   that way you dont use state which is still associated with the

Re: [sqlalchemy] Threading and session

2010-01-12 Thread Jules Stevenson
Worked it out, sorry for the noise. self.task = self.Session.merge(self.task) -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

Re: [sqlalchemy] foreign key to *any* other class?

2010-01-11 Thread Jules Stevenson
Thanks Michael, very useful. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options,

[sqlalchemy] foreign key to *any* other class?

2010-01-10 Thread Jules Stevenson
Sorry for the bad subject, and probably incorrect terminology but is it possible to set up a table that would allow a foreign key link (or any other technique) that would enable it to bind against *any* other mapped class? The context for this is there is a DB table that stores tasks to be

[sqlalchemy] Re: Adjacency list problem

2009-08-13 Thread Jules Stevenson
the mapping seems perfect to me.  parent_invoice would only be None for the actual parent.  perhaps there's some issue with your usage.   check your SQL echoing to make sure things are as expected. My bad, was using 5.0, not 5.5 - just upgraded and it works fine.

[sqlalchemy] Newbie: Adding a column after database table has been created, declarative

2008-11-10 Thread Jules Stevenson
Hi, Apologies for lowering the general IQ of the list, I'm very new to web apps and databases. I had a declarative table: class ArkContact(Base): table of all contacts __tablename__ = 'contacts' id = Column(Integer, primary_key=True) project_id = Column(Integer,