[sqlalchemy] Re: 2 questions

2007-11-13 Thread svilen
clarification for this below; i have non-ORM updates happening inside ORM transaction (in after_insert() etc). How to make them use the parent transaction? i have a connection there. and, why atomic updates also have with commit after them? or is this sqlite-specific? every CRUD

[sqlalchemy] Object Init Bug?

2007-11-13 Thread Koen Bok
Hi, I have this strange bug or problem... I have a basic class like this mapped to a table with the same name. Metatype is a relation to the metatype object. class MetaData(DBObject): def __init__(self, metatype, value, item): self.metatype = metatype

[sqlalchemy] Re: 2 questions

2007-11-13 Thread Rick Morrison
i have non-ORM updates happening inside ORM transaction (in after_insert() etc). How to make them use the parent transaction? i have a connection there. You can pass in the Session and use Session.execute() to reuse the session connection. --~--~-~--~~~---~--~~

[sqlalchemy] Re: 2 questions

2007-11-13 Thread Rick Morrison
in the after_*() there are (mapper, connection, instance) arguments - but there's no session. Any way to get to that? mapext.get_session() does not look like one http://www.sqlalchemy.org/docs/04/sqlalchemy_orm.html#docstrings_sqlalchemy.orm_modfunc_object_session

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Gerhard Haering
On Tue, 13 Nov 2007 06:00:25 -0800, Simon Pamies [EMAIL PROTECTED] wrote: [...] I'm very pleased to announce the release of SQLAutocode 0.4.1 and 0.5. This tool enables SQLAlchemy users to automagically generate python code from an existing database layout [...] Could you perhaps

[sqlalchemy] Re: Object Init Bug?

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 8:25 AM, Koen Bok wrote: Hi, I have this strange bug or problem... I have a basic class like this mapped to a table with the same name. Metatype is a relation to the metatype object. class MetaData(DBObject): def __init__(self, metatype, value, item):

[sqlalchemy] Re: SA 0.4 weird behaviour

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 2:51 AM, fw wrote: Hi, I am having a weird problem. I am dealing with some legacy database, so I subclass TypeDecorator to help clean things up a bit. This worked fine in 0.3 but I am now trying to use 0.4 and things break in the strangest of way. When I run the

[sqlalchemy] Re: threadlocal transactions, engine, and the Session

2007-11-13 Thread Rick Morrison
I use a similar technique with a Pylons controller, but instead of engine.begin(), I use session.begin(). Then by passing around the session for all calls made by that controller, I can use Session.execute() for expression-based and text-based SQL mixed with ORM ops, and it all commits in one shot

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Werner F. Bruhin
Hi Gerhard, Gerhard Haering wrote: On Tue, 13 Nov 2007 06:00:25 -0800, Simon Pamies [EMAIL PROTECTED] wrote: [...] I'm very pleased to announce the release of SQLAutocode 0.4.1 and 0.5. This tool enables SQLAlchemy users to automagically generate python

[sqlalchemy] Joined Table Inheritance and One-to-One headache

2007-11-13 Thread Alexandre Conrad
Hi, I've attached a test script as I'm confused with what I'm trying to do. I have the following scenario: - A Channel object is TV channel: class Channel: pass - A Playlist object is a piece of a channel's TV program. class Playlist: pass - A Playlist can be declined as different

[sqlalchemy] Re: SA 0.4 weird behaviour

2007-11-13 Thread jason kirtland
fw wrote: Hi, I am having a weird problem. I am dealing with some legacy database, so I subclass TypeDecorator to help clean things up a bit. This worked fine in 0.3 but I am now trying to use 0.4 and things break in the strangest of way. When I run the file below, Python complains

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Paul Johnston
Hi, Could you perhaps explain the advantages/differences to autoload=True or perhaps SqlSoup? To me, it's quite a different approach to managing your database schema. Using autoload or sqlsoup, the database holds the master definition of the schema, and your program automatically loads

[sqlalchemy] ticket 819/r3762

2007-11-13 Thread svilen
what a coincidence, 2 days ago we stepped on this bindparam-types thing; table.some_decimal_column == decimal.Decimal(5) did not always work. now it mostly works, i think there is one more case that breaks for me: when the column itself is hidden in a function. e.g. table_A = Table(

[sqlalchemy] Re: ticket 819/r3762

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 12:24 PM, svilen wrote: what a coincidence, 2 days ago we stepped on this bindparam-types thing; table.some_decimal_column == decimal.Decimal(5) did not always work. now it mostly works, i think there is one more case that breaks for me: when the column itself is

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Simon Pamies
On Nov 13, 4:53 pm, Werner F. Bruhin [EMAIL PROTECTED] wrote: Gerhard Haering wrote: On Tue, 13 Nov 2007 06:00:25 -0800, Simon Pamies [EMAIL PROTECTED] wrote: Could you perhaps explain the advantages/differences to autoload=True I understand that autoload=True has a pretty high overhead.

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Simon Pamies
On Nov 13, 6:09 pm, Paul Johnston [EMAIL PROTECTED] wrote: Could you perhaps explain the advantages/differences to autoload=True or perhaps SqlSoup? To me, it's quite a different approach to managing your database schema. Using autoload or sqlsoup, the database holds the master

[sqlalchemy] Re: 2 questions

2007-11-13 Thread svilen
On Monday 12 November 2007 23:11:25 Michael Bayer wrote: On Nov 12, 2007, at 2:07 PM, [EMAIL PROTECTED] wrote: hi 1st one: i am saving some object; the mapperExtension of the object fires additional atomic updates of other things elsewhere (aggregator). These things has to be

[sqlalchemy] Re: 2 questions

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 2:00 PM, svilen wrote: i'm not sure if i am doing proper thing at all. Something like i need intermediate flush() to get B in the database first; then the insert of A will update that B and expire it eventualy. i.e. i need to have the B record in the DB in order to

[sqlalchemy] How to use GROUP BY and HAVING in orm?

2007-11-13 Thread Andrew Stromnov
I have this SQL expression (from http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html) SELECT b.* FROM tagmap bt, bookmark b, tag t WHERE bt.tag_id = t.tag_id AND (t.name IN ('bookmark', 'webservice', 'semweb')) AND b.id = bt.bookmark_id GROUP BY b.id HAVING COUNT( b.id )=3 How

[sqlalchemy] Re: How to use GROUP BY and HAVING in orm?

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 5:17 PM, Andrew Stromnov wrote: I have this SQL expression (from http://www.pui.ch/phred/archives/2005/04/tags-database-schemas.html) SELECT b.* FROM tagmap bt, bookmark b, tag t WHERE bt.tag_id = t.tag_id AND (t.name IN ('bookmark', 'webservice', 'semweb')) AND

[sqlalchemy] FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread Simon Pamies
Hi, I'm very pleased to announce the release of SQLAutocode 0.4.1 and 0.5. This tool enables SQLAlchemy users to automagically generate python code from an existing database layout and even has the possibility to generate example code working with the generated model. It now supports SA

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread m h
On Nov 13, 2007 5:14 AM, Simon Pamies [EMAIL PROTECTED] wrote: Hi, I'm very pleased to announce the release of SQLAutocode 0.4.1 and 0.5. This tool enables SQLAlchemy users to automagically generate python code from an existing database layout and even has the Hey Simon, I found your code

[sqlalchemy] Re: FYI: SQLAutocode 0.4.1 and 0.5 released

2007-11-13 Thread m h
On Nov 13, 2007 4:44 PM, m h [EMAIL PROTECTED] wrote: On Nov 13, 2007 5:14 AM, Simon Pamies [EMAIL PROTECTED] wrote: Hi, I'm very pleased to announce the release of SQLAutocode 0.4.1 and 0.5. This tool enables SQLAlchemy users to automagically generate python code from an existing

[sqlalchemy] Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread bob
Hi, I am going over this this example to learn how to construct an eager- loaded adjacency tree, http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/byroot_tree.py and I noticed that some of the keys in the treenodes table are given long names in the table

[sqlalchemy] Re: threadlocal transactions, engine, and the Session

2007-11-13 Thread Huy Do
Hi Rick, I use a similar technique with a Pylons controller, but instead of engine.begin(), I use session.begin(). Then by passing around the session for all calls made by that controller, I had so much legacy SA code, that I just couldn't easily retrofit this pattern throughout the code,

[sqlalchemy] Re: Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread jason kirtland
bob wrote: Hi, I am going over this this example to learn how to construct an eager- loaded adjacency tree, http://www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/examples/adjacencytree/byroot_tree.py and I noticed that some of the keys in the treenodes table are given long names in

[sqlalchemy] Re: Question regarding an adjacency-tree example in svn repo

2007-11-13 Thread bob
Thanks for clearing that up! :) Bob --~--~-~--~~~---~--~~ 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 email to

[sqlalchemy] trunk's new anon_N labeled subqueries break some eagerloading queries

2007-11-13 Thread Chris M
I didn't see any tickets about this on the trac, so I thought I'd bring it to everyones attention. Since it's a development version I wasn't sure if this mattered (or was known about), so if it does I can draft up a quick test case. --~--~-~--~~~---~--~~ You

[sqlalchemy] Learning SQLAlchemy - some questions on mapped selects and set-based update/delete in sessions

2007-11-13 Thread Luke Opperman
Hello - I'm learning SA at the moment (using 0.4), so I apologize if any questions go against the grain or assume something silly, I'm looking for the SA answer to how to do the following things. Similarly, I'm going to throw some possible syntax up, but I don't know the SA style well enough yet

[sqlalchemy] Re: threadlocal transactions, engine, and the Session

2007-11-13 Thread Michael Bayer
On Nov 13, 2007, at 7:46 PM, Huy Do wrote: Hi Rick, I use a similar technique with a Pylons controller, but instead of engine.begin(), I use session.begin(). Then by passing around the session for all calls made by that controller, I had so much legacy SA code, that I just couldn't easily

[sqlalchemy] Re: trunk's new anon_N labeled subqueries break some eagerloading queries

2007-11-13 Thread Michael Bayer
definitely need a test case illustrating what problem you encountered. On Nov 13, 2007, at 9:17 PM, Chris M wrote: I didn't see any tickets about this on the trac, so I thought I'd bring it to everyones attention. Since it's a development version I wasn't sure if this mattered (or was

[sqlalchemy] Re: threadlocal transactions, engine, and the Session

2007-11-13 Thread Huy Do
I was hoping that I could create a another session using another engine (non threadlocal), for these special cases. I have not yet run into this need yet. Just out of interest, have you run into any such use cases ? Thanks if youre using threadlocal engine, you can still say

[sqlalchemy] Re: trunk's new anon_N labeled subqueries break some eagerloading queries

2007-11-13 Thread Chris M
http://www.sqlalchemy.org/trac/ticket/864 On Nov 13, 10:35 pm, Michael Bayer [EMAIL PROTECTED] wrote: definitely need a test case illustrating what problem you encountered. On Nov 13, 2007, at 9:17 PM, Chris M wrote: I didn't see any tickets about this on the trac, so I thought I'd

[sqlalchemy] Re: SA 0.4 weird behaviour

2007-11-13 Thread fw
Thanks for the answer. The trace is Traceback (most recent call last): File test.py, line 227, in ? StockItem.mapper[Primary]=mapper(StockItem, tblStock, properties={ File .../sqlalchemy/orm/__init__.py, line 518, in mapper return Mapper(class_, local_table, *args, **params) File

[sqlalchemy] Re: SA 0.4 weird behaviour

2007-11-13 Thread fw
Thanks for the answer It looks indeed like a log operation. When adding __repr__ no error message. Spot on. Cheers, François File test.py, line 230, in ? StockItem.mapper[Primary]=mapper(StockItem, tblStock, properties={ AttributeError: type object 'StockItem' has no