[sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Matthew Pounsett
Does the ORM allow for filtering by a variable attribute name? I found this discussion using raw SQL: https://groups.google.com/d/topic/sqlalchemy/Axa-0thwOR8/discussion But the suggestion doesn't seem to apply in my case. Some sample code to demonstrate what I'm trying based on the above

Re: [sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Simon King
On Tue, Jul 23, 2013 at 8:17 AM, Matthew Pounsett matt.pouns...@gmail.com wrote: Does the ORM allow for filtering by a variable attribute name? I found this discussion using raw SQL: https://groups.google.com/d/topic/sqlalchemy/Axa-0thwOR8/discussion But the suggestion doesn't seem to apply

[sqlalchemy] mysql error creating Table

2013-07-23 Thread M3nt0r3
I am porting a building scheme system to mysql ( it works on postgresql and sqlite so far ) but i have some issues with datetime ( solved ) and with ( within others tables ) this table : t_listino_articolo = Table('listino_articolo', params[metadata], Column('id_listino',

[sqlalchemy] quoting in a sub clause

2013-07-23 Thread matt g
Hi, We are using sqlalchemy with Amazon Redshift. One of the things that I wanted to do was to create a custom construct for Redshift's unload statement. I modified the sample InsertFromSelect (http://docs.sqlalchemy.org/en/rel_0_8/core/compiler.html?highlight=insertfromselect). However, we

Re: [sqlalchemy] quoting in a sub clause

2013-07-23 Thread Michael Bayer
On Jul 23, 2013, at 11:09 AM, matt g mgeo...@gmail.com wrote: Hi, We are using sqlalchemy with Amazon Redshift. One of the things that I wanted to do was to create a custom construct for Redshift's unload statement. I modified the sample InsertFromSelect

Re: [sqlalchemy] quoting in a sub clause

2013-07-23 Thread matt g
The literal_binds looks great. Do you know of a function that I can use that will take the string from compiler.process(select_statement, literal_binds=True) and escapes the single quotes in that string? For instance, if I have the following (assuming that the table object has already been

[sqlalchemy] Rolling back all changes between unit tests

2013-07-23 Thread Ib Lundgren
Hey all, I'd like to have a clean DB between tests, one approach that works is to drop tables and recreate fixtures. This can be quite slow and I'd rather have something more lean. If possible I'd like to create a snapshot before each test and rollback to the snapshot after each test. From

Re: [sqlalchemy] quoting in a sub clause

2013-07-23 Thread Michael Bayer
you might need to implement your own @compile for BindParam which does extra work based on some new **kw that you can send through to process(), or if your special **kw isn't present, calls compiler.visit_bindparam(param). On Jul 23, 2013, at 12:29 PM, matt g mgeo...@gmail.com wrote: The

Re: [sqlalchemy] filtering by variable attribute names

2013-07-23 Thread Matthew Pounsett
On Tuesday, 23 July 2013 04:16:24 UTC-4, Simon King wrote: You can use the standard python getattr function for this: Ah, of course. That should have occurred to me to try. Thanks, works like a charm! -- You received this message because you are subscribed to the Google Groups