On 2/7/07, Kumar McMillan <[EMAIL PROTECTED]> wrote:
>
> > > 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 creating a new
> > on each time?
>
> Are you using postgres?  The only problem I foresee is if your test
> does some work with table instances shared by the fixtures but doesn't
> explicitly call rollback when there is an exception.  You will
> probably even get a deadlock if that happens.  `ps aux | grep
> postgres` will show if a fixture's delete statement is waiting on
> another transaction.  I've tried to accomodate for this scenario so
> let me know if you run into it again so I can add some tests for it.

I will watch out for this and let you know.  I may just reinitialize
the entire session and engine for each fixture.  Initially I was
thinking that this may be difficult but as you point out it may be
even more troublesome to keep trying to use the same session.  I will
try it and let you know.

[..]
> > ...and points out a problem I am going to
> > have using it.  In my current code I am not keeping the tables or
> > mappers around.  Instead I have a database manager class that sets
> > everthing up and simply holds onto the session and engine that should
> > be used to query the database.  I rely upon the mapped classes to keep
> > track of the table and metadata references internally.
> >
> > So... is there any way to associated a dataset with the Class type
> > that is associated with the data in the dataset?
> >
> > for example maybe something like:
> >
> > class anything_I_want(DataSet):
> >    mappedType = MyDataClass
> >    class click:
> >       name="click"
> >
> > or something else along these lines.  This seems like it would work
> > well to tie the data back to the class type that is actually being
> > mapped.  Then the "anything_I_want" class is really just a list of
> > MyDataClass objects that need to be populated into the database.
>
> Yes, I've made an attempt to support mapped classes but there are many
> different ways to map classes so I might not have captured them all.
> Please try:
>
> class anything_i_want(DataSet):
>     class Meta:
>         storable=MyDataClass
>     class click:
>         name="click"
>
> and let me know if that doesn't work, so I can get an idea for how you
> are using mapped classes.

I am about to try it but I have one further question.  With all the
changes you have been making and adding, where is the best place to
look for an example of what I should actually be trying to do with the
code? :)

Right now I am doing my best to sort through the e-mails and go from
there.  If there is an example or wiki page on the project site I
should look at though please let me know.

Thanks,
Allen

>
>
> -Kumar
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to