[sqlalchemy] Re: Column metadata from mapped class

2008-07-22 Thread Sean Davis
On Jul 20, 11:28 am, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 20, 2008, at 7:48 AM, Sean Davis wrote: I have been playing with 0.5 and have a very simple question.  If I have a mapped class, User, how can I get at the columns of User?  I see lots of constructs like User.c,

[sqlalchemy] Re: Overriding table columns with Python-property

2008-07-22 Thread Malthe Borch
Michael Bayer wrote: well, i can support this in 0.5 trunk. in rev 4965, If a descriptor is present on a class, or if the name is excluded via the include/ exclude lists, the attribute will not be instrumented via the inherited mapper or via the mapped Table. So your example works with

[sqlalchemy] Elixir 0.6.0 released!

2008-07-22 Thread Gaetan de Menten
I am very pleased to announce that version 0.6.0 of Elixir (http://elixir.ematia.de) is now available. As always, feedback is very welcome, preferably on Elixir mailing list. Please look at: http://elixir.ematia.de/trac/wiki/Migrate05to06 for detailed upgrade notes. Here are the highlights for

[sqlalchemy] Re: Overriding table columns with Python-property

2008-07-22 Thread Malthe Borch
Michael Bayer wrote: well, i can support this in 0.5 trunk. in rev 4965, If a descriptor is present on a class, or if the name is excluded via the include/ exclude lists, the attribute will not be instrumented via the inherited mapper or via the mapped Table. So your example works with

[sqlalchemy] Help - Two relations to same table

2008-07-22 Thread Erez
Hi, I apologize in advance if this is a newbie question, but this is pretty wierd and I couldn't find an answer in the docs. I have these two tables: class Node(Base): __tablename__ = 'nodes' id = Column(Integer, primary_key=True) name = Column(String) class

[sqlalchemy] Re: Overriding table columns with Python-property

2008-07-22 Thread Michael Bayer
this issue is not specific to the recent changes; this would happen even with the old behavior (since exclude_properties was meant to mean, I dont want SQLA to know about this column at all typically in a reflection scenario). its fixed in r4966. On Jul 22, 2008, at 7:27 AM, Malthe

[sqlalchemy] Logger problem

2008-07-22 Thread Alen Ribic
The SQLAlchemy default logging seems to use StreamHandler to write to sys.stdout. This cause a problem when writing Python CGI scripts I (unfortunately) have to. The problem is that the SA logger writes to sys.stdout before HTTP headers get writen by my homegrown web cgi framework. See snippet

[sqlalchemy] Re: Logger problem

2008-07-22 Thread Michael Bayer
On Jul 22, 10:22 am, Alen Ribic [EMAIL PROTECTED] wrote: To get my cgi app to work, I can either: 1.) set Echo = False or 2.) I comment out the handler lines in log.py above and from there my own logger directs the SA log to my app's log file. Both of the above ways do the trick.

[sqlalchemy] Support for old-style classes in inheritance tree

2008-07-22 Thread Malthe Borch
Currently, classes that inherit from old-style classes are not supported on two accounts: 1) They do not provide the __subclasses__-method 2) It's not possible to make a weak reference to them Below is a patch that effectively ignores them: Index: lib/sqlalchemy/util.py

[sqlalchemy] Re: Column metadata from mapped class

2008-07-22 Thread huy do
On Jul 22, 1:33 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 21, 2008, at 9:45 PM, huy do wrote: Because a mapped class can have an arbitary select as it's source i.e columns from any table theoretically, it would still be nice to know exactly which columns were used to map the

[sqlalchemy] Default logging writes to sys.stdout, before HTTP headers are set in CGI script

2008-07-22 Thread alrex021
The SQLAlchemy default logging seems to use StreamHandler to write to sys.stdout. This cause a problem when writing Python CGI scripts I (unfortunately) have to. The problem is that the SA logger writes to sys.stdout before HTTP headers get writen by my homegrown web cgi framework. See snippet

[sqlalchemy] Re: Column metadata from mapped class

2008-07-22 Thread Michael Bayer
On Jul 22, 8:04 am, huy do [EMAIL PROTECTED] wrote: On Jul 22, 1:33 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 21, 2008, at 9:45 PM, huy do wrote: Because a mapped class can have an arbitary select as it's source i.e columns from any table theoretically, it would still be

[sqlalchemy] Re: SavePoint question

2008-07-22 Thread Werner F. Bruhin
Michael, Michael Bayer wrote: ... if FB didn't raise an error when you said begin_nested() then i think SAVEPOINT is working. Any number of SAVEPOINTS are still all contained within the larger transaction, though. If you want u3 to be committed regardless of the transaction, you'd have

[sqlalchemy] Re: Logger problem

2008-07-22 Thread Alen Ribic
dont use echo at all, configure logging through Python logging. echo corresponds to sqlalchemy.engine/INFO. http://www.sqlalchemy.org/docs/05/dbengine.html#dbengine_logging Thanks for the ref Michael. That will work perfectly. -Al --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: Save file to FS along with object database commit.

2008-07-22 Thread Heston James - Cold Beans
Afternoon All, Hello Guys, I have an object which I save to the database using SQLAlchemy, the class is defined using declarative and has a whole bunch of properties. This object has one property though which isn't saved to the database, but to the file system. It is basically a binary

[sqlalchemy] Re: Run basic query

2008-07-22 Thread Bobby Impollonia
The sqlalchemy update statement is documented here: http://www.sqlalchemy.org/docs/05/sqlexpression.html#sql_update Basically, you want something like conn.execute(foo.update(values={foo.c.bar: 0 })) On Tue, Jul 22, 2008 at 10:49 AM, Heston James - Cold Beans [EMAIL PROTECTED] wrote: Guys,

[sqlalchemy] cloning tables from object model

2008-07-22 Thread morecowbell
greetings, in my app i'm processing rows in a mysql table and i've trying to use SA in ORM-like manner and got stuck at something presumably totally simple. i have a class Orders and mapped the oder_table to Order and now i'm processing each row in order_table. one column in the table is

[sqlalchemy] Re: Help - Two relations to same table

2008-07-22 Thread Michael Bayer
On Jul 22, 2008, at 1:48 PM, Erez wrote: So how would you solve it? I tried defining two foriegn keys: class Link(Base): __tablename__ = 'links' node_id = Column(Integer, ForeignKey('nodes.id')) node_id2 = Column(Integer, ForeignKey('nodes.id')) id =

[sqlalchemy] Re: Implementing saved searches

2008-07-22 Thread Michael Bayer
On Jul 22, 2:23 pm, Philip Semanchuk [EMAIL PROTECTED] wrote: I'm new to SqlAlchemy. I'm trying to implement saved searches, like a mail program folder   that says, Show me all emails received yesterday, or All emails   with 'grail' in the subject. One wrinkle is that my application  

[sqlalchemy] Re: Implementing saved searches

2008-07-22 Thread Philip Semanchuk
On Jul 22, 2008, at 2:42 PM, Michael Bayer wrote: On Jul 22, 2:23 pm, Philip Semanchuk [EMAIL PROTECTED] wrote: I'm new to SqlAlchemy. I'm trying to implement saved searches, like a mail program folder that says, Show me all emails received yesterday, or All emails with 'grail' in the

[sqlalchemy] Re: Implementing saved searches

2008-07-22 Thread Michael Bayer
On Jul 22, 2008, at 3:55 PM, Philip Semanchuk wrote: In our app, SQLite has big advantages over other databases so I don't mind deepening our ties to it. It won't be going away anytime soon. Being bound to a specific table structure is indeed less appealing and that's my main objection to

[sqlalchemy] Query is checking for transaction status

2008-07-22 Thread Harish
Hi all, I am trying to do a count on a particular table : session.query(User).count() To get the number of User objects in the database. I am getting the exception below : return self.session.query( File c:\python24\lib\site-packages\SQLAlchemy-0.4.6-py2.4.egg \sqlalchemy\orm\

[sqlalchemy] Re: ODBC connection URI

2008-07-22 Thread M.-A. Lemburg
On 2008-05-27 17:28, Michael Bayer wrote: On May 27, 2008, at 11:19 AM, Rick Morrison wrote: To be honest I thought this was how we were doing it, but (incredulously) looking at the source I see theres a dsn keyword argument in there ?!? ... What's the argument for DSN as the official

[sqlalchemy] Re: Help - Two relations to same table

2008-07-22 Thread Erez
On Jul 22, 4:51 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Jul 22, 2008, at 6:50 AM, Erez wrote: Hi, I apologize in advance if this is a newbie question, but this is pretty wierd and I couldn't find an answer in the docs. I have these two tables: class Node(Base):    

[sqlalchemy] Re: Query is checking for transaction status

2008-07-22 Thread Michael Bayer
On Jul 22, 5:33 pm, Harish [EMAIL PROTECTED] wrote: The session is transactional with autoflush=False. Why is a query trying to find out the status of session? Is there anything that could have been done wrong? Thanks in advance for the help! that error is usually when flush() raises an

[sqlalchemy] Re: Help - Two relations to same table

2008-07-22 Thread Michael Bayer
On Jul 22, 2008, at 6:50 AM, Erez wrote: Hi, I apologize in advance if this is a newbie question, but this is pretty wierd and I couldn't find an answer in the docs. I have these two tables: class Node(Base): __tablename__ = 'nodes' id = Column(Integer, primary_key=True)

[sqlalchemy] SavePoint question

2008-07-22 Thread Werner F. Bruhin
I have a similar case to what is shown in the doc, here my slightly different usecase, see the commit for u3 and a final rollback. Session = sessionmaker() sess = Session() sess.add(u1) sess.add(u2) sess.begin_nested() # establish a savepoint sess.add(u3) # in my case this is data I would