Re: [sqlalchemy] Rolling back all changes between unit tests

2013-07-24 Thread Pau Tallada
Hi! A successful commit cannot be rolled back. Do not use commit. Use session.flush instead, then you could use rollback to revert changes. Cheers, Pau. 2013/7/23 Ib Lundgren ib.lundg...@gmail.com Hey all, I'd like to have a clean DB between tests, one approach that works is to drop

Re: [sqlalchemy] Rolling back all changes between unit tests

2013-07-24 Thread Ladislav Lenart
Hello. I am not familiar with the usage of nested transactions, though I am pretty sure what you want is possible. I would like to suggest a simpler approach. If you implement all your functions without commit and move the commit to one place (e.g. to the end of a web request processing), you

[sqlalchemy] changing the column order of a select

2013-07-24 Thread Jon Nelson
Let's say I've built up a select statement but only after it's built do I know the order of the columns that I'd ultimately prefer. What's the best way to change the column order of a select? -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] changing the column order of a select

2013-07-24 Thread Michael Bayer
you can do that using this: http://docs.sqlalchemy.org/en/rel_0_8/core/expression_api.html?highlight=select#sqlalchemy.sql.expression.Select.with_only_columns but you'd need to restate all the columns. On Jul 24, 2013, at 10:59 AM, Jon Nelson jnel...@jamponi.net wrote: Let's say I've built

[sqlalchemy] joined-table inheritance and ambiguous foreign keys

2013-07-24 Thread Seth P
The code below produces the error message below. How do I tell SQLAlchemy that the inheritance join condition should be b.id == a.id rather than b.parent_a_id == a.id? (I would think the primary_key=True could be a hint...) I can't figure it out from the documentation. class A(Base):

Re: [sqlalchemy] joined-table inheritance and ambiguous foreign keys

2013-07-24 Thread Michael Bayer
its a mapper arg called inherit_condition: __mapper_args__ = {inherit_condition: id==A.id} On Jul 24, 2013, at 3:42 PM, Seth P spadow...@gmail.com wrote: The code below produces the error message below. How do I tell SQLAlchemy that the inheritance join condition should be b.id == a.id

Re: [sqlalchemy] joined-table inheritance and ambiguous foreign keys

2013-07-24 Thread Seth P
Thank you. On Wed, Jul 24, 2013 at 5:51 PM, Michael Bayer mike...@zzzcomputing.comwrote: its a mapper arg called inherit_condition: __mapper_args__ = {inherit_condition: id==A.id} On Jul 24, 2013, at 3:42 PM, Seth P spadow...@gmail.com wrote: The code below produces the error message

[sqlalchemy] oracle reflect with duplicated tables (schema casing)

2013-07-24 Thread mdob
Hi, I got into an interesting issue where I receive duplicated tables if I use capital letters schema in reflect method. Ubuntu 12.04 with packages oracle-instantclient11.2-basiclite-11.2.0.3.0-1.i386.rpm, oracle-instantclient11.2-devel-11.2.0.3.0-1.i386.rpm,

Re: [sqlalchemy] oracle reflect with duplicated tables (schema casing)

2013-07-24 Thread Michael Bayer
On Jul 24, 2013, at 7:34 PM, mdob mike.dobrzan...@gmail.com wrote: Hi, I got into an interesting issue where I receive duplicated tables if I use capital letters schema in reflect method. you wouldn't want to do that unless the table were actually created using a case-sensitive name,

Re: [sqlalchemy] oracle reflect with duplicated tables (schema casing)

2013-07-24 Thread Victor Olex
Hey Mike, thanks for chiming in. Popular tool Oracle SQL Develoepr generally produces DDL with quoted identifiers so in real life you will encounter a lot of situations where some tables were created using quoted and some unquoted as people work on maintaining the database. Using lowercase