[sqlalchemy] Re: Info needed regarding the use of cascade

2008-11-20 Thread --- [EMAIL PROTECTED] ---
I got you now Thank you Simon --~--~-~--~~~---~--~~ 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 [EMAIL

[sqlalchemy] UnboundExecutionError and lazyness

2008-11-20 Thread Lawrence Oluyede
I've hit the problem explained here: http://groups.google.com/group/sqlalchemy/msg/499a0765d426e12b but I didn't quite understand how to work around it. I have a series of mappings relations with lazy=True and one of them in some situations seems having that problem. To be honest everything

[sqlalchemy] Re: Data logging and many-to-many's

2008-11-20 Thread Joril
Quite complicated, I see X-) Anyway, I've been able to implement the clean way you suggested (or at least the test suite says so :) ).. Many thanks again for your time, you've been very helpful! (Thanks to Svil too for your contribution!) --~--~-~--~~~---~--~~ You

[sqlalchemy] Insert Column

2008-11-20 Thread Rohith
How to insert a column between two columns in MS SQL? Not in MYSQL eg: if in table ABC a and b are column and I want to insert c column between a and b column. One way to drop b column first then add c then again insert b but that is not safe (if data not empty). Is there any Query in MS SQL

[sqlalchemy] confused about how functions work

2008-11-20 Thread Moshe C.
table.update(criterion, values={'last_edited' : func.now()} ).execute () works but table.update(criterion ).execute({'last_edited' : func.now()}) does not. It tries to set 'last_edited' to functions object. Can someone clarify the difference ?

[sqlalchemy] Re: confused about how functions work

2008-11-20 Thread az
turn echo/logging on and see the difference. one embeds it in the statement, another comes as runtime bind-param. i guess u cannot give funcs as bind-parameters (runtime) ?? On Thursday 20 November 2008 14:42:16 Moshe C. wrote: table.update(criterion, values={'last_edited' : func.now()}

[sqlalchemy] Re: Insert Column

2008-11-20 Thread Empty
Hi On Thu, Nov 20, 2008 at 12:45 AM, Rohith [EMAIL PROTECTED] wrote: How to insert a column between two columns in MS SQL? Not in MYSQL eg: if in table ABC a and b are column and I want to insert c column between a and b column. One way to drop b column first then add c then again insert

[sqlalchemy] Re: confused about how functions work

2008-11-20 Thread Michael Bayer
in one case the update() statement is constructed knowing the VALUES clause ahead of time so that it can render the NOW() function. In the latter case, execute() compiles the update() statement passing along the key names of the given parameters but not the values, which are all assumed to be

[sqlalchemy] Re: UnboundExecutionError and lazyness

2008-11-20 Thread Michael Bayer
Lawrence Oluyede wrote: UnboundExecutionError: Parent instance Configuration at 0x8ce466c is not bound to a Session; lazy load operation of attribute 'parent' cannot proceed the error means simply this: x = session.query(X).get(5) del session # or session.clear(), session.expunge(x),

[sqlalchemy] tometadata for declarative

2008-11-20 Thread mg
Is there any sort of tometadata for the declarative layer in sqlalchemy? If I have a declarative class, I want to be able re-create that class for another metadata. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: tometadata for declarative

2008-11-20 Thread Michael Bayer
this can only be done as far as the Table object. the mapper() and declarative base class doesn't have any kind of clone method: newtable = MyClass.__table__.tometadata(somemetadata) class MyNewClass(SomeBase): __table__ = newtable mg wrote: Is there any sort of tometadata for the

[sqlalchemy] Insert.params() broken?

2008-11-20 Thread bukzor
Sorry for double posting. I pressed Send before I was ready... Please let me know if I'm doing something wrong here: [code] metadata = MetaData('sqlite:///first.sqlite') table = Table('my_table', metadata, Column('text', Unicode(16))) stmt = table.insert()

[sqlalchemy] ORM mapping with Elixir compared to raw cursor query

2008-11-20 Thread SinJax
Hi, I've made this post already on my blog but it was suggested i post here as it might be an interesting point of discussion. The first scenario is a single table with 24,000 rows. The problem is that using SQLAlchemy through Elixir to map this table to an object, and performing a fairly naive

[sqlalchemy] Insert.params() broken?

2008-11-20 Thread bukzor
I expect I'm doing this wrong, but it seems broken to me. Please let me know. Here's what I'm doing: stmt = metadata.tables['tf_user'].insert() parameters=dict(id=1,user_name='bgolemon',password='badpass',display_name='Buck Golemon',created=None) print stmt.compile().params

[sqlalchemy] Re: Insert.params() broken?

2008-11-20 Thread Michael Bayer
On Nov 20, 2008, at 6:16 PM, bukzor wrote: The second crashes with: File /tools/aticad/1.0/external/python-2.4.1/lib/python2.4/site- packages/SQLAlchemy-0.5.0rc4-py2.4.egg/sqlalchemy/sql/expression.py, line 3515, in _copy_internals self.parameters = self.parameters.copy()

[sqlalchemy] Re: ORM mapping with Elixir compared to raw cursor query

2008-11-20 Thread Michael Bayer
On Nov 20, 2008, at 7:07 PM, SinJax wrote: Hi, I've made this post already on my blog but it was suggested i post here as it might be an interesting point of discussion. The first scenario is a single table with 24,000 rows. The problem is that using SQLAlchemy through Elixir to map this

[sqlalchemy] Re: Insert.params() broken?

2008-11-20 Thread bukzor
When you say generative, do you mean it returns a new object, as opposed to in-place changes? Would it make sense to rename Insert.values to Insert.params? Or make Insert.params call Insert.values. It seems quite strange for an object to have functions that aren't usable... Different, but

[sqlalchemy] Invalid SQL for not None on relation attributes

2008-11-20 Thread Yoann Roman
I'm getting invalid SQL when I try to filter for records that have no matching related record in a one-to-one relationship using the not_ function. For example, with address being a relation from User: print User.id==None users.id IS NULL print not_(User.id==None) users.id IS NOT NULL print

[sqlalchemy] Re: Insert.params() broken?

2008-11-20 Thread Michael Bayer
On Nov 20, 2008, at 9:05 PM, bukzor wrote: When you say generative, do you mean it returns a new object, as opposed to in-place changes? Would it make sense to rename Insert.values to Insert.params? Or make Insert.params call Insert.values. It seems quite strange for an object to have

[sqlalchemy] Re: Invalid SQL for not None on relation attributes

2008-11-20 Thread Michael Bayer
very nice - this fix is applied in r5314. It's not every day someone gives us a patch for strategies.py...have any more ? :) On Nov 20, 2008, at 9:47 PM, Yoann Roman wrote: I'm getting invalid SQL when I try to filter for records that have no matching related record in a one-to-one