[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread svil
mmmh. This is about underlying base-framework of a system, equivalent in complexity to ERP. So i have unknown hierarchy of classes - be them documents, entities, whatever u fancy. And they can point to each other in an unknown way. if u want some example: DocumentA1 has some data and

[sqlalchemy] Re: scalar select: wrong result types

2007-01-17 Thread [EMAIL PROTECTED]
the above query you are issuing straight textual SQL. SA has no clue what types to return and it has no say in it - the inconsistent behavior above originates within your database/DBAPI (which you havent told me which one it is). I'm using Mysql5 A very simple table that give me problems:

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Jonathan Ellis
On 1/17/07, Antonio [EMAIL PROTECTED] wrote: and now, how can I retrieve the file (res.pdf.data) in a file or send it as output in a html page (sendig the right headers) ? Nothing magical: file('foo.pdf', 'wb').write(res.pdf.data) see your html framework's docs for instructions on sending

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Jonathan Ellis
Oops, I didn't notice at first that you are using pg_largeobject... That's not a good idea, you should really use bytea (for SA, that means declaring filepdf as a Binary column itself rather than linking to pg_largeobject) unless you are planning to manually seek inside the lo (i.e. with

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread Michael Bayer
svil wrote: P.S. u can remove the other repeating post from another account fo mine - seems GG has weird latenicies, hence i double posted... and first one appeared 10hrs later than second. its because google marked them all as spam. seeing as there were 5 duplicate messages, i let one

[sqlalchemy] Re: Postgre e pg_largeobject

2007-01-17 Thread Cliff Wells
On Wed, 2007-01-17 at 11:45 +0100, Antonio wrote: Hi all, I'm trying to read a pdf file saved in a postgresql table : and now, how can I retrieve the file (res.pdf.data) in a file or send it as output in a html page (sendig the right headers) ? Antonio, I did a very similar thing (storing

[sqlalchemy] Re: portable schema

2007-01-17 Thread Michael Bayer
if you want the behavior to happen within SA itself in a transparent way, youd have to provide redefined versions of sqlite.SLDialect and mysql.MSDialect and friends which add these behaviors in. but personally I wouldnt want to insert those behaviors into SA itself. id rather write an app

[sqlalchemy] Re: scalar select: wrong result types

2007-01-17 Thread Michael Bayer
without seeing a full example, its looking like a mysql bug. SA's datetime implementation for MySQL doesnt do any conversion from return value since MySQLDB handles that task. whereas the sqlite dialect in SA *does* do conversion since sqlite doesnt handle that.

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread Michael Bayer
svil wrote: So i have unknown hierarchy of classes - be them documents, entities, whatever u fancy. And they can point to each other in an unknown way. so, you are looking to create an application that generates python applications, basically. if you want to use SA for that, you have to

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread svil
So i have unknown hierarchy of classes - be them documents, entities, whatever u fancy. And they can point to each other in an unknown way. so, you are looking to create an application that generates python applications, basically. hm, can be interpreted this way. just add 'and interpret

[sqlalchemy] MapperExtension errors

2007-01-17 Thread Michael Arick
I seem to have stumbled upon a bug, but perhaps I'm just using MapperExtension wrong. Anyway, here's some code that doesn't work: --- from sqlalchemy import * from sqlalchemy.orm import MapperExtension global_session = create_session() metadata = BoundMetaData('mysql://[EMAIL

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread Michael Bayer
svil wrote: is it errorneus to explicitly put the (correct) joins even if they could be figured out by SA? its not. but made your code that much harder to read (there was a lot more that made it even harder, thats just one cherry-picked example). Two examples are the StaticType declarative

[sqlalchemy] Re: MapperExtension errors

2007-01-17 Thread Michael Bayer
its python and its unfortunate typing error behaviorextension needs to be an instance: testmapper = mapper(Test, test_table, extension=ModifiedMapper()) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread svil
is it errorneus to explicitly put the (correct) joins even if they could be figured out by SA? its not. but made your code that much harder to read well, this case does require them :-( which has a way to interpret python functions into Expr-trees, which then can be translated (read

[sqlalchemy] Re: ORM ramblings 2 - and announcing some o2r wrapper

2007-01-17 Thread Michael Bayer
On Jan 17, 2007, at 5:09 PM, svil wrote: 110. can't make it less ;-) can? and it is about A=Employee and B=Manager, and all Employees having a manager. http://linuxteam.sistechnology.com/orm/sa_B_inh_A_A_ref_AB2.py OK. the first attachment called test_case1.py is how I'd like you to send

[sqlalchemy] Re: Action on object deletion

2007-01-17 Thread Michael Bayer
yeah im trying to keep SA as simple as possible, and whatever hooks and extensions I put in are because they are absolutely needed (like the various MapperExtension hooks are allowing you to put code in the middle of existing processes, i.e. template methods). for extending Session, current

[sqlalchemy] Re: Profiling mode

2007-01-17 Thread Jonathan Ellis
I finally came back to this. Here's what I ended up with: # I tried to enable profiling on a per-engine level before resorting to this # hack. (Monkey-patching classes by scanning the gc! Woot!) # # Per-engine profile turns out to totally not work because there's so many # layers of clever

[sqlalchemy] Re: Profiling mode

2007-01-17 Thread Jonathan Ellis
Thinking about it more, I should probably just override the methods of Connection itself and not worry about subclasses. If someone is overriding _execute*, he can do his own damn profiling. :) On 1/17/07, Jonathan Ellis [EMAIL PROTECTED] wrote: I finally came back to this. Here's what I