[sqlalchemy] [ANN] Fixture Goes 1.0 (tool for testing with data)

2008-07-18 Thread Kumar McMillan
I've just pushed 1.0 -- the *I Heart Data* release -- of fixture, a Python module for loading and referencing test data. It is used heavily at my work in two test suites: one for the functional tests of an ETL framework and another for a Pylons + Elixir (SQLAlchemy) + Ext JS web application.

[sqlalchemy] Re: a way to share Session.mapper(SomeObject) across two scoped sessions?

2008-01-25 Thread Kumar McMillan
On Jan 25, 2008 11:58 AM, Michael Bayer [EMAIL PROTECTED] wrote: ...so this test will pass if you change setUp to read: Session.mapper(SomeObject, table, properties={ 'options':relation(SomeOtherObject) }, save_on_init=False)

[sqlalchemy] Re: a way to share Session.mapper(SomeObject) across two scoped sessions?

2008-01-25 Thread Kumar McMillan
On Jan 24, 2008 2:46 PM, Kumar McMillan [EMAIL PROTECTED] wrote: but, since I am explicitly saving it to a new session and the session has a different scope, shouldn't this be possible? Maybe I'm not fully understanding scoped sessions. I am hesitant to file this as a bug because I'm not sure

[sqlalchemy] a way to share Session.mapper(SomeObject) across two scoped sessions?

2008-01-24 Thread Kumar McMillan
This is a spin-off from the thread on how to do setup/test-app/teardown: http://groups.google.com/group/sqlalchemy/browse_thread/thread/4fd6344bf8b9c033 (thanks for everyone's help on that) I had posted test code that illustrates it's possible to save/delete a mapped object using two different

[sqlalchemy] How to accomplish setup/run-app/teardown with mapped classes and sessions?

2008-01-23 Thread Kumar McMillan
Hello, I have not been able to figure this out from the docs. I would like to setup and teardown test data using mapped classes. The problem is that those same mapped classes need to be used by the application under test and in case there is an error, the teardown still needs to run so that

[sqlalchemy] Re: How to accomplish setup/run-app/teardown with mapped classes and sessions?

2008-01-23 Thread Kumar McMillan
Hi On Jan 23, 2008 4:07 PM, Michael Bayer [EMAIL PROTECTED] wrote: your teardown code can't have any dependencies on the test code itself. So at the very least start the teardown phase with PrivateSession.close() so that you start fresh. I tried adding that to the teardown code but then

[sqlalchemy] Re: How to accomplish setup/run-app/teardown with mapped classes and sessions?

2008-01-23 Thread Kumar McMillan
On Jan 23, 2008 4:36 PM, Kumar McMillan [EMAIL PROTECTED] wrote: ...but it still fails with the same error, Deleted rowcount 0 does not match number of objects deleted 1. What am I missing? I don't understand how the teardown code is dependent on the app code if it is using a different

[sqlalchemy] Re: detect if objects have been deleted from a session?

2007-09-25 Thread Kumar McMillan
Thanks for the quick response. On 9/24/07, Michael Bayer [EMAIL PROTECTED] wrote: but also i dont understand the problem you're having. the ConcurrentModificationError should only happen if you are issuing a literal DELETE statement to the database which conflicts with the session trying to

[sqlalchemy] detect if objects have been deleted from a session?

2007-09-24 Thread Kumar McMillan
Hello. I have a naive system that links dict-like objects to mapped classes so that rows can be saved to the db. It doesn't know anything about mapped class instances, so many-to-many relationships are [currently] saved by a class mapped to the swing table itself; for example, it's the

[sqlalchemy] Re: new setuptools vs local SA copy

2007-02-09 Thread Kumar McMillan
, or hack your python like i did). Kumar McMillan wrote: put a file -pythonpath.pth into your site_packages folder: import os, sys; sys.__egginsert=len(os.environ.get('PYTHONPATH', '').split(os.pathsep)); duly noted for future usage _when_ i meet an egg. workingenv, as Simon

[sqlalchemy] Re: new setuptools vs local SA copy

2007-02-08 Thread Kumar McMillan
put a file -pythonpath.pth into your site_packages folder: import os, sys; sys.__egginsert=len(os.environ.get('PYTHONPATH', '').split(os.pathsep)); duly noted for future usage _when_ i meet an egg. workingenv, as Simon King mentioned, is the way to go. At my company we share a dev

[sqlalchemy] Re: Unit testing with SA?

2007-02-07 Thread Kumar McMillan
db = SQLAlchemyFixture() # anytime before db.data().setup() ... db.session = my_session In my current system I have a single global session that is used for everything. Is there any reason you can see that I could not just reuse this session in all the test cases or should I be

[sqlalchemy] how do I set an engine to autocommit?

2007-02-01 Thread Kumar McMillan
I have a program that is entering a deadlock (pyscopg) after an exception since the test suite tries to delete stuff as part of cleanup. I tried wrapping everything in a transaction to be sure a rollback is called but it *appears* that when I start using transaction.session.bind_to.execute(stmt)

[sqlalchemy] Re: how do I set an engine to autocommit?

2007-02-01 Thread Kumar McMillan
...but it *appears* that when I start using transaction.session.bind_to.execute(stmt) directly, it is not part of the transaction. uh yeah...why would it be ? youre essentially pulling out the original bind_to engine which has no idea about what particular connection/transaction is

[sqlalchemy] Re: how do I set an engine to autocommit?

2007-02-01 Thread Kumar McMillan
/07, Kumar McMillan [EMAIL PROTECTED] wrote: the fact that the deadlock was solved when I added the connection to the transaction tells me that psycopg runs in commit mode automatically (even though dbapi 2 says it should not). The psycopg docs reinforce this too : http://www.initd.org

[sqlalchemy] work directly with table clauses in transactions?

2007-01-29 Thread Kumar McMillan
I'm trying to work on something where it's necessary to discover table objects and then perform inserts and deletes in a transaction. It's proving very cumbersome to try and locate the existing mappers for these tables or create them automatically so I'm now trying to work directly with

[sqlalchemy] Re: DynamicMetaData + create/drop table = confusion

2007-01-12 Thread Kumar McMillan
, not sure. also the sql echo shows that something is weird...its inserting a row, then deleting it, using id 1, which is what the id should be. the rowcount should definitely be 1 and not 0. On Jan 11, 2007, at 8:30 PM, Kumar McMillan wrote: hi. the reason for the flush strangeness is I

[sqlalchemy] Re: DynamicMetaData + create/drop table = confusion

2007-01-12 Thread Kumar McMillan
oh, nice. upgrading sqlite to 3.3.7 and rebuilding pysqlite2 fixed it -- sorry for the noise. On 1/12/07, Kumar McMillan [EMAIL PROTECTED] wrote: uggh, pysqlite 2.1 fixed some other problems I was having in transactions iirc. I'm scared to upgrade/downgrade :( On 1/11/07, Michael Bayer

[sqlalchemy] DynamicMetaData + create/drop table = confusion

2007-01-06 Thread Kumar McMillan
hello. I'm trying to use DynamicMetaData so that two separate tests can each connect to a unique db, create some tables, insert some data, delete that data, then drop the tables. This seems to yield ... sqlalchemy.exceptions.ConcurrentModificationError: Updated rowcount 0 does not match number