[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-22 Thread Oliver Beattie
Figured it out. I had two self-referential foreign keys on the table, both pointing (obviously) to the primary key, but for some reason I was specifying foreign_keys to the relations, I just removed these arguments to the relations and this has resolved itself. On Aug 19, 12:28 pm, Oliver Beattie

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-19 Thread Oliver Beattie
mike...@zzzcomputing.com wrote: On Aug 18, 2010, at 12:29 PM, Oliver Beattie wrote: On Aug 18, 3:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: Sent from my iPhone On Aug 18, 2010, at 8:27 AM, Oliver Beattie oli...@obeattie.com wrote: I'm not entirely sure why this is happening

[sqlalchemy] INSERT…RETURNING being issued wrongly

2010-08-18 Thread Oliver Beattie
I'm not entirely sure why this is happening… it seems to work for me in nearly all other circumstances so I'm a bit stumped. Basically, I have a declarative table which has a character field as its primary key (it's not an ID which can be returned by the server), yet SQLAlchemy is issuing an

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Oliver Beattie
I'm using Postgres On Aug 18, 1:27 pm, Oliver Beattie oli...@obeattie.com wrote: I'm not entirely sure why this is happening… it seems to work for me in nearly all other circumstances so I'm a bit stumped. Basically, I have a declarative table which has a character field as its primary key

[sqlalchemy] Re: INSERT…RETURNING being issued wro ngly

2010-08-18 Thread Oliver Beattie
On Aug 18, 3:39 pm, Michael Bayer mike...@zzzcomputing.com wrote: Sent from my iPhone On Aug 18, 2010, at 8:27 AM, Oliver Beattie oli...@obeattie.com wrote: I'm not entirely sure why this is happening… it seems to work for me in nearly all other circumstances so I'm a bit stumped

[sqlalchemy] Comparable properties

2010-07-07 Thread Oliver Beattie
Hi, I am just wondering if it is possible to allow a declarative object to have some of its properties comparable as if they were ClauseElements. I know I'm not explaining myself terrifically well here, but consider the following property: @property def is_visible(self): return

[sqlalchemy] Passing multiple keys to undefer()

2010-07-02 Thread Oliver Beattie
Hi there, The documentation for the undefer() method seems to indicate that it should be able to accept multiple positional arguments for keys, however trying this results in an error. I wanted to post this here to check I'm right in thinking this before I file a ticket. The docs give the

Re: [sqlalchemy] Abridged summary of sqlalchemy@googlegroups.com - 14 Messages in 7 Topics

2010-06-14 Thread Oliver Beattie
Aa Sent from my iPhone On Jun 14, 2010, at 12:39 AM, sqlalchemy+nore...@googlegroups.com sqlalchemy+nore...@googlegroups.com wrote: Today's Topic Summary Group: http://groups.google.com/group/sqlalchemy/topics - Multiple databases or multiple schemas? #group_thread_0 [2 Updates] -

[sqlalchemy] UnicodeEncodeError driving me mad

2010-05-11 Thread Oliver Beattie
I have some code that is taking values out of one database (a MySQL latin-1 database) and inserting them into another (postgres, utf-8) database, and I can't for the life of me work out what is going wrong here. The traceback looks slightly fishy, so I can only assume something is going horribly

[sqlalchemy] Re: UnicodeEncodeError driving me mad

2010-05-11 Thread Oliver Beattie
to utf-8 logic can be re-established on 0.6 by also adding use_native_unicode=False. Docs athttp://www.sqlalchemy.org/docs/reference/dialects/postgresql.html#uni...(as of just now) On May 11, 2010, at 12:04 PM, Oliver Beattie wrote: I have some code that is taking values out

[sqlalchemy] Two subclasses (single table inheritance) both requiring the same columns

2010-05-07 Thread Oliver Beattie
Hi there, I have some (declarative, polymorphic) classes that use single-table inheritance. My configuration is similar to the below: class BasicObject(Base): col1 = Column(…) # discriminator, polymorphic setup etc class ObjectOne(BasicObject): col2 = Column(…) col3 = Column(…) class

[sqlalchemy] Re: Getting access to the object being updated inside a default callable?

2010-03-05 Thread Oliver Beattie
Sorry to bug… I imagine there is no way of doing this, but would be good to know for sure. If not, this would be really useful functionality. For instance, I might want to populate one column based on the contents of one of more other columns. On 12 Jan, 11:21, Oliver Beattie oli...@obeattie.com

[sqlalchemy] Re: Getting access to the object being updated inside a default callable?

2010-03-05 Thread Oliver Beattie
, they cease to be column-level defaults. On Mar 5, 2:48 pm, Michael Bayer mike...@zzzcomputing.com wrote: Oliver Beattie wrote: Sorry to bug I imagine there is no way of doing this, but would be good to know for sure. If not, this would be really useful functionality. For instance, I might

[sqlalchemy] Multiple relations to the same table in a base declarative class causes errors when querying

2010-02-23 Thread Oliver Beattie
Hi all, I've run into something I can't for the life of me work out why is happening. I've done a quick search and can't find anything. Basically, I have a base class that is subclassed (single table inheritance) with two relations both pointing to one other table. I'm probably confusing as hell,

[sqlalchemy] Re: Multiple relations to the same table in a base declarative class causes errors when querying

2010-02-23 Thread Oliver Beattie
Ah, thanks so much. Guess sometimes you just need a second pair of eyes to spot where you've messed it up :) On Feb 23, 7:29 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 23, 2010, at 1:03 PM, Oliver Beattie wrote: Hi all, I've run into something I can't for the life of me work

[sqlalchemy] Re: How to make relation to same table

2010-02-23 Thread Oliver Beattie
You probably want to take a look at http://www.sqlalchemy.org/docs/05/mappers.html#adjacency-list-relationships On Feb 23, 5:42 pm, flya flya flyafl...@gmail.com wrote: here is code: Base = declarative_base() class Page(Base):    __tablename__ = 'pages'    id = Column(Integer,

[sqlalchemy] Getting access to the object being updated inside a default callable?

2010-01-12 Thread Oliver Beattie
Hi there, I feel like I'm perhaps missing something, but I wonder if there's any way to access the object being updated inside a ColumnDefault? More specifically, if I have a… let's call it DBObject (using declarative) which has a callable as its default, is there any way to access that DBObject

[sqlalchemy] Functions on results of subquery question

2009-11-27 Thread Oliver Beattie
grateful. Thanks, Oliver Beattie -- 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] Multiple relations to the same table us ing declarative… I think I'm being a total idiot

2009-11-11 Thread Oliver Beattie
Hi all, I know I'm probably missing something painfully obvious here, but here goes anyway. I'm trying to create a table which has two foreign keys to a different table, and failing miserably. I understand I'm supposed to use the primaryjoin argument to relation… here's what I have in my class

[sqlalchemy] Re: Multiple relations to the same tabl e using declarative… I think I'm being a total idiot

2009-11-11 Thread Oliver Beattie
And we have a winner. Always check you are actually passing the values to the class constructor that you think you are before posting in a public group, folks. I've think I've succeeded in humiliating myself for today… On Nov 11, 11:52 am, Oliver Beattie oli...@obeattie.com wrote: Hi all, I

[sqlalchemy] Re: What happens if a session is closed inside a subtransaction?

2009-10-16 Thread Oliver Beattie
way to do it, but it does eliminate a lot of try...except...else's since I do need the explicit subtransaction stuff. In any case, thanks for clearing that up for me, and it's good to know about those accessors. On Oct 14, 3:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: Oliver Beattie

[sqlalchemy] Re: What happens if a session is closed inside a subtransaction?

2009-10-16 Thread Oliver Beattie
I should probably ask something else too… how much overhead is there in using subtransactions as opposed to one global transaction? On Oct 14, 3:18 pm, Michael Bayer mike...@zzzcomputing.com wrote: Oliver Beattie wrote: Hi All, I'm just wondering what happens if I were to call

[sqlalchemy] What happens if a session is closed inside a subtransaction?

2009-10-14 Thread Oliver Beattie
Hi All, I'm just wondering what happens if I were to call session.close() whilst inside a subtransaction? Would it indeed close the session and abort all of the parent transactions or would it do nothing? Looking at the code (and I haven't looked at it in any great detail, sorry) I imagine that