[sqlalchemy] with_polymorphic()

2010-08-30 Thread Julien Cigar
Hello, Quick question, is there a way to use .with_polymorphic() on a Query with existing criterion ? I have the case where I have 2 queries with the same criteria where one of those queries is a count(*). I would like to avoid multiple LEFT JOIN because criteria in the count(*) query

Re: [sqlalchemy] Re: Read only property

2010-08-30 Thread Petr Kobalíček
I have small question regarding the viewonly property. Can I assign viewonly to a column? In the SqlA example it's used together with relationship(), I need to mark viewonly just table column. For example: RecordTable = Table('t_record', metadata, Column('record_id', Integer, primary_key =

Re: [sqlalchemy] with_polymorphic()

2010-08-30 Thread Michael Bayer
On Aug 30, 2010, at 5:59 AM, Julien Cigar wrote: Hello, Quick question, is there a way to use .with_polymorphic() on a Query with existing criterion ? I have the case where I have 2 queries with the same criteria where one of those queries is a count(*). I would like to avoid multiple

Re: [sqlalchemy] with_polymorphic()

2010-08-30 Thread Julien Cigar
On 08/30/2010 16:06, Michael Bayer wrote: On Aug 30, 2010, at 5:59 AM, Julien Cigar wrote: Hello, Quick question, is there a way to use .with_polymorphic() on a Query with existing criterion ? I have the case where I have 2 queries with the same criteria where one of those queries is a

[sqlalchemy] DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Petr Kobalíček
Hi devs, I added %% into my DDL and sqlalchemy raises the TypeError: 'dict' object does not support indexing. The critical part is: row_array t_record%%ROWTYPE in the DDL. Em I using the DDL correctly? I read that I need to double the '%' character and I did that. Best regards Petr

Re: [sqlalchemy] string_agg() with order by clause

2010-08-30 Thread David Gardner
On 08/27/2010 09:21 PM, Michael Bayer wrote: you coerce incoming arguments into expressions at the constructor level: from sqlalchemy.sql.expression import _literal_as_column class MyWhatever(ColumnElement): def __init__(self, expr, ...): self.expr = _literal_as_column(expr)

Re: [sqlalchemy] DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Michael Bayer
On Aug 30, 2010, at 12:10 PM, Petr Kobalíček wrote: Hi devs, I added %% into my DDL and sqlalchemy raises the TypeError: 'dict' object does not support indexing. The critical part is: row_array t_record%%ROWTYPE in the DDL. Em I using the DDL correctly? I read that I need to

Re: [sqlalchemy] DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Petr Kobalíček
Hi Michael, thanks for reply, I tried triple escaping before I posted the first message, but the error is the same. Interesting is fact that i can add 20 '%' characters into the DDL but in SQL INFO I always see only one '%'. Is there other workaround? Can I safely replace the line described in:

Re: [sqlalchemy] DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Petr Kobalíček
Hi Michael, triple escaping works, sorry for misinformation. Best regards Petr -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to

[sqlalchemy] Re: DDL and TypeError: 'dict' object does not support indexing

2010-08-30 Thread Sven A. Schmidt
Just wondering if it's any different if you try the tripe quote syntax For example in a similar case I use q = select os, count(os) from ( select distinct s.id, os from server s join instance_server ins on s.id =

[sqlalchemy] Re: Read only property

2010-08-30 Thread Mark
Hi Petr, I think if you are the owner of the database schema, you can grant select, update, delete only to the columns that you want from MySQL/ Oracle/PostgreSQL/MS-SQL. I think this is something done on the database side of things, not in SQLAlchemy. I checked the documentation of SQLAlchemy

[sqlalchemy] How to add a record to one-to-many relation using a single query?

2010-08-30 Thread Russell Warren
I've been through the orm tutorial several times now and the employee- addresses one-to-many example is a good one. I'm stumped on one thing so far. Say I want to add a new address for a user where the user name is wendy. I only know her name and new email address. And I want it done in one