[sqlalchemy] How do you execute pure SQL against placeholders?

2007-03-01 Thread metaperl
This would seem to be an easy obvious task, but searching both this newsgroup and the SQLAlchemy.org website do not turn up any docs on the process. I want to get a result proxy for executing this SQL, in the processing binding the variable dayno to searchSchedule: def load(sa, dayno): take

[sqlalchemy] prettyprint sql

2007-03-01 Thread svilen
i have made a hack to make the sql/echo look somewhat better - level-indented + more line-separations. it auto-applies itself over the sqlachemy at runtime. usage: just import sahack4src e.g. SELECT pu_human.address_id AS pu_human_address_id, FROM (SELECT person.address_id AS address_id,

[sqlalchemy] Joins with 3 tables to order results?

2007-03-01 Thread Chris Shenton
I've got a 'system' table which has a foreign key client_id to a 'client' table, and that has a FK vendor_id to a 'vendor' table. Currently I query and order by client_id and system attribute like:: systems = self.session.query(System).select(or_(System.c.lastseen == None,

[sqlalchemy] Re: prettyprint sql

2007-03-01 Thread Michael Bayer
are we talking about adding a couple of \ns around ansicompiler ? sure. on the other hand, if talking about it applied as an optional monkeypatch thing, id prefer it as a logging.Formatter. On Mar 1, 12:57 pm, svilen [EMAIL PROTECTED] wrote: i have made a hack to make the sql/echo look

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread Michael Bayer
use a python function as your column default ? http://www.sqlalchemy.org/docs/metadata.myt#metadata_defaults_oninsert On Feb 28, 6:00 pm, askel [EMAIL PROTECTED] wrote: Hello everyone, Is there a way to access current record from DefaultGenerator? I have balances table that collect

[sqlalchemy] Re: How do you execute pure SQL against placeholders?

2007-03-01 Thread Michael Bayer
text(select * from usersearches where searchschedule=:dayno, engine=myengine).execute(dayno=5) ? that would be here: http://www.sqlalchemy.org/docs/sqlconstruction.myt#sql_textual_textual_binds On Mar 1, 10:20 am, metaperl [EMAIL PROTECTED] wrote: This would seem to be an easy obvious

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-03-01 Thread Michael Bayer
yeah its a bug, its all fixed (several issues with text columns) in 2368. --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-03-01 Thread Dennis
Thanks! On Mar 1, 1:31 pm, Michael Bayer [EMAIL PROTECTED] wrote: yeah its a bug, its all fixed (several issues with text columns) in 2368. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread askel
Michael, Thanks for reply but I know about that. The question is how do I access a record that requires default value from withing that function. Something like the following: def prev_balance(): new_bal = get_record_that_is_being_inserted() # === that is what I'm looking for return

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread Michael Bayer
people ask for this function occasionally, what i dont like about it is that it would greatly complicate things just to produce functionality that isnt really needed. for example, if you want one of the columns in your INSERT to be driven off the values in the other columns, why not just prepare

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread askel
Michael, On Mar 1, 8:04 pm, Michael Bayer [EMAIL PROTECTED] wrote: people ask for this function occasionally, what i dont like about it is that it would greatly complicate things just to produce functionality that isnt really needed. It wasn't my intention to ask anybody to implement such a

[sqlalchemy] Re: contains_eager is somehow not loading all the instances.

2007-03-01 Thread Michael Bayer
yeah its a bug, its all fixed (several issues with text columns) in 2368. On Feb 28, 2007, at 4:46 PM, Dennis wrote: On Feb 28, 12:30 pm, Michael Bayer [EMAIL PROTECTED] wrote: you have to show me what youre doing since from my understanding, youre using literal text, and nothing should

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread Michael Bayer
oh youd want insert from a select ? yah we have never added support for that construct directly but you can issue it as text for now... im looking at the default code and it wouldnt be too hard to give it access to the execution context and make the parameters available and all that, it

[sqlalchemy] Re: How do you execute pure SQL against placeholders?

2007-03-01 Thread Michael Bayer
text(select * from usersearches where searchschedule=:dayno, engine=myengine).execute(dayno=5) ? that would be here: http://www.sqlalchemy.org/docs/ sqlconstruction.myt#sql_textual_textual_binds On Mar 1, 2007, at 10:20 AM, metaperl wrote: This would seem to be an easy obvious task,

[sqlalchemy] Re: Column default that is aware of whole record to be inserted

2007-03-01 Thread Michael Bayer
use a python function as your column default ? http://www.sqlalchemy.org/docs/metadata.myt#metadata_defaults_oninsert On Feb 28, 2007, at 6:00 PM, askel wrote: Hello everyone, Is there a way to access current record from DefaultGenerator? I have balances table that collect information on

[sqlalchemy] Re: query on self-referencing polymorphic mapper

2007-03-01 Thread Michael Bayer
On Mar 1, 2007, at 12:44 PM, svilen wrote: hi. i have the case of polymorphic mapper referencing itself (or other of it's sub-class objects), and i want to query/filter on a value of the referenced object. e.g. all people who have friends of age 25. these are highly highly complex

[sqlalchemy] SQA failing on table creation

2007-03-01 Thread percious
Here is the dump: [EMAIL PROTECTED] percious]$ tg-admin sql create Creating tables at mysql://percious:[EMAIL PROTECTED]:3306/percious Traceback (most recent call last): File /home2/percious/bin/tg-admin, line 7, in ? sys.exit( File /home2/percious/lib/python2.4/TurboGears-1.0-py2.4.egg/