[sqlalchemy] SA generates invalid SQL when creating tables in sqlite using (attached) schemata

2010-07-13 Thread Ralph Heinkel
Hi, this might be another small bug in SA. It shows up when an Sqlite db is composed of multiple sub-DBs via the 'attach' statement. This is useful for mimicking schemata and allows tables to be addressed like schema.table (using common dot-syntax). To make the following work run this statement

RE: [sqlalchemy] Problem with Joined Table inheritance

2010-07-13 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of Jules Stevenson Sent: 13 July 2010 15:01 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Problem with Joined Table inheritance Apologies for any stupidity, but I'm

Re: [sqlalchemy] Problem with Joined Table inheritance

2010-07-13 Thread Stefano Bartaletti
class ArkWebVideoWidget(object): should be class ArkWebVideoWidget(ArkWebWidget): -- Beauty is a pair of shoes that makes you wanna die -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] delete attributes of last flush or commit in a MapperExtension already executed

2010-07-13 Thread sacabuche
I was trying to get the last value before_insert a new item but i didn't find out, so i change of strategy and i saved the last value of this method, but the problem is that when i do other commits my old MapperExtension attribute (self.last_value) get the last value and i dislike it, even when I

Re: [sqlalchemy] SA generates invalid SQL when creating tables in sqlite using (attached) schemata

2010-07-13 Thread Michael Bayer
On Jul 13, 2010, at 5:44 AM, Ralph Heinkel wrote: Hi, this might be another small bug in SA. It shows up when an Sqlite db is composed of multiple sub-DBs via the 'attach' statement. This is useful for mimicking schemata and allows tables to be addressed like schema.table (using common

Re: [sqlalchemy] delete attributes of last flush or commit in a MapperExtension already executed

2010-07-13 Thread Michael Bayer
On Jul 13, 2010, at 10:21 AM, sacabuche wrote: I was trying to get the last value before_insert a new item but i didn't find out, so i change of strategy and i saved the last value of this method, but the problem is that when i do other commits my old MapperExtension attribute

Re: [sqlalchemy] SA generates invalid SQL when creating tables in sqlite using (attached) schemata

2010-07-13 Thread Michael Bayer
On Jul 13, 2010, at 10:31 AM, Michael Bayer wrote: On Jul 13, 2010, at 5:44 AM, Ralph Heinkel wrote: Hi, this might be another small bug in SA. It shows up when an Sqlite db is composed of multiple sub-DBs via the 'attach' statement. This is useful for mimicking schemata and allows

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] Doing a UNION and aliasing columns

2010-07-13 Thread Andrew Bialecki
I tried to write the following code assuming a User class with first_name, last_name, and email: search_term = Andrew by_email = session.query(User.email.label(text), User.email.label(email)).filter(User.email.like(%%%s%% % search_term) by_first_name = session.query(User.first_name.label(text),

Re: [sqlalchemy] Doing a UNION and aliasing columns

2010-07-13 Thread Michael Bayer
that's an intricate trick which currently doesn't work with the ORM. #1852 is added to see if there's a quick way to fix this (very likely there isn't something quick). You'd have to trick it using column(email) or something like that. On Jul 13, 2010, at 3:02 PM, Andrew Bialecki wrote: I

Re: [sqlalchemy] Doing a UNION and aliasing columns

2010-07-13 Thread Andrew Bialecki
Any thoughts on a workaround? On Tue, Jul 13, 2010 at 3:40 PM, Michael Bayer mike...@zzzcomputing.com wrote: that's an intricate trick which currently doesn't work with the ORM.   #1852 is added to see if there's a quick way to fix this (very likely there isn't something quick). You'd have

[sqlalchemy] finding mapper from table

2010-07-13 Thread Kent
I know how to get the mapper given a class or object. How do I find the mapper or class given the table? -- 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

Re: [sqlalchemy] Doing a UNION and aliasing columns

2010-07-13 Thread Conor
On 07/13/2010 02:43 PM, Andrew Bialecki wrote: Any thoughts on a workaround? Since you're selecting individual columns instead of mapped classes, the ORM doesn't provide much benefit over straight SQL expressions. Try this (untested): by_email = select([User.email.label(text),

[sqlalchemy] Oracle, Decimal, and 0.6.2

2010-07-13 Thread Rodney
I just upgraded to 0.6.2 and the new handling of Decimal for Oracle is giving me trouble. More specifically, I have a query that's pulling data from a pipeline function (e.g., SELECT * FROM TABLE (func (:a,:b,:c))). In previous SA versions, a couple of the columns were correctly returned as

[sqlalchemy] Re: unexpected query behaviour

2010-07-13 Thread Ste
On Jul 11, 6:14 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 11, 2010, at 5:39 AM, Ste wrote: What I still don't understand is, that if I run the same query in pdb immediately after the raise, I get back None (which is what I would expected). I seem to recall MySQL had some

[sqlalchemy] UnboundExecutionError gotcha when working with scoped_session

2010-07-13 Thread Steven Wei
I ran into an interesting behavior when working with SQLAlchemy 0.6.2 and scoped_sessions: if you instantiate a Session before you call Session.configure(bind=engine), none of the Sessions you create will be properly bound to the engine you configured. Here's a short sample snippet that

Re: [sqlalchemy] finding mapper from table

2010-07-13 Thread Michael Bayer
there's no API for that and you'd have to keep track of that yourself using a decorator around mapper(). or hunt through all the registered mappers which isn't quite public API. On Jul 13, 2010, at 3:56 PM, Kent wrote: I know how to get the mapper given a class or object. How do I find

Re: [sqlalchemy] Oracle, Decimal, and 0.6.2

2010-07-13 Thread Michael Bayer
On Jul 13, 2010, at 5:01 PM, Rodney wrote: I just upgraded to 0.6.2 and the new handling of Decimal for Oracle is giving me trouble. More specifically, I have a query that's pulling data from a pipeline function (e.g., SELECT * FROM TABLE (func (:a,:b,:c))). In previous SA versions, a

Re: [sqlalchemy] UnboundExecutionError gotcha when working with scoped_session

2010-07-13 Thread Michael Bayer
On Jul 13, 2010, at 5:18 PM, Steven Wei wrote: I ran into an interesting behavior when working with SQLAlchemy 0.6.2 and scoped_sessions: if you instantiate a Session before you call Session.configure(bind=engine), none of the Sessions you create will be properly bound to the engine you