Re: [sqlalchemy] Primary key set on object after rollback

2018-09-26 Thread Doug Miller
Thanks. This occurs on create/insert so I would probably remove all primary keys. Is there a reason why a handler would work better here? I’d prefer to keep my logic central and avoid callbacks if possible. -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper

Re: [sqlalchemy] Primary key set on object after rollback

2018-09-25 Thread Doug Miller
I think my issue is that before the commit/rollback Alice.id is None but after Alice.id is set to some integer. I understand the object is transient but I wish that the primary key field was not modified in this way because if I want to try to reinsert Alice in a new transaction I have to write

[sqlalchemy] Primary key set on object after rollback

2018-09-25 Thread Doug Miller
I've noticed that if a transaction fails midway through, objects that already have been inserted will have their primary keys set, even after rolling back. Partial snippet below: - class User(Base): id = Column(Integer, primary_key=True) name = Column(String(80), unique=True,

Re: [sqlalchemy] Understanding session.begin(subtransactions=True) as a context manager

2017-09-28 Thread Doug Farrell
Hi Mike, Thanks very much for the response and the clear explanation, and the link. All of that was very helpful to me, and I'm made some changes to my code accordingly. I am using Flask-SQLAlchemy by the way, so what you wrote makes even more sense in that context. Doug On Thursday

[sqlalchemy] Understanding session.begin(subtransactions=True) as a context manager

2017-09-28 Thread Doug Farrell
in the right direction, give me some suggestions or references about what I'm missing. Thanks, Doug -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example

Re: [sqlalchemy] SQLAlchemy 0.8.0b2 released

2012-12-14 Thread Doug Latornell
On Fri, Dec 14, 2012 at 1:11 PM, Michael Bayer mike...@zzzcomputing.comwrote: Hi list - SQLAlchemy 0.8.0b2 is released. This is hopefully the last beta for 0.8, as things have been mostly quiet surrounding 0.8.0b1, we had a few regressions fixed, and a bunch of other new bugs whose fixes

Re: [sqlalchemy] Sqlalchemy tuning : pool_size and pool_recycle

2012-06-29 Thread Doug Latornell
in the morning would typically fail because the connection had been dropped overnight. I set pool_recycle to 3600 (seconds) and had no more dropped connection problems. As with all app tuning issues, YMMV... Doug -- You received this message because you are subscribed to the Google Groups sqlalchemy group

Re: [sqlalchemy] WITH (nolock) on all queries

2011-06-28 Thread Doug Morgan
). Thanks, Doug On Tue, Jun 28, 2011 at 12:39 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Jun 28, 2011, at 2:55 PM, Alexandre Conrad wrote: I must have it wrong, I admit I don't quite understand the arguments of .with_hint() session.query(User).with_hint(User, 'WITH (nolock)').get(1

[sqlalchemy] Metadata error when using Apache mod_wsgi

2011-06-08 Thread doug holt
with SQLite and didn't encounter this error. I also don't run into this error if I serve the application using paster. Thanks for any help, Doug -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy

[sqlalchemy] Re: Metadata error when using Apache mod_wsgi

2011-06-08 Thread doug holt
Seems like it is an Apache problem. This error occurred on Apache 2.2.13 but not on a system with 2.2.19. On Jun 8, 1:57 pm, doug holt doug.h...@gmail.com wrote: Hi, I'm getting a strange error in sqlalchemy/engine/base.py when I try to use a mysql table with more than 6 columns and serve

[sqlalchemy] Unmapped Column Error

2011-03-03 Thread Doug
=category_association.c.ParentCategoryID == BankCategories.ID, backref='children') This does not work and I get the following error: File '/home/doug/pyenv_svn/CreateService/surveyservice/surveyservice/ controllers/error.py', line 25 in document cat.parents File

[sqlalchemy] Re: Unmapped Column Error

2011-03-03 Thread Doug
, backref='children') Which works just dandy. Thanks again, Doug On Mar 3, 3:07 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Mar 3, 2011, at 5:11 PM, Doug wrote: Hello all, I've just started using SQLAlchemy recently (and it's been great) but I have run into a problem

[sqlalchemy] unsubscribe

2009-01-20 Thread Doug Farrell
unsubscribe --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: SQLAlchemy 0.5 Released

2009-01-06 Thread Doug Farrell
Michael, Congratulations on the release! I look forward to giving it a spin! Doug --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-12-03 Thread Doug Farrell
@googlegroups.com Subject: [sqlalchemy] Re: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat I keep thinking one of my relatives has emailed me when you post here and I get all excited. Any chance you can change your name ? :-) 2008/12/2 Doug Farrell [EMAIL

[sqlalchemy] Re: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-12-02 Thread Doug Farrell
Michael, Thanks for the pointer, that makes great sense, and once again points how my generally small database design skills. I'll update my code to try this out. Again, Thanks! Doug From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bayer Sent: Saturday

[sqlalchemy] Re: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-11-29 Thread Doug Farrell
: New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat What was your justification of changing the name of my thread to a completely different topic instead of starting a new thread? I don't think thats good etiquette. On Nov 29, 5:22 am, Doug

[sqlalchemy] New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-11-29 Thread Doug Farrell
: Sqlalchemy.orm.exc.FlushError: New instance [EMAIL PROTECTED] With identity key (class '__main__.ExtraStat',(u'C',)) conflicts with persistent instance [EMAIL PROTECTED] Thanks! Doug --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] New instance ExtraStat with identity key (...) conflicts with persistent instance ExtraStat

2008-11-28 Thread Doug Farrell
with persistent instance [EMAIL PROTECTED] Thanks! Doug --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Declarative application example

2008-10-28 Thread Doug Farrell
and that I'm not missing something. I'm guessing the Session having a strong reference keeps the object alive even though I delete it from the list. Again, thanks! Doug -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bayer Sent: Tuesday, October

[sqlalchemy] Re: InvalidRequestError and ConcurrentModification problems

2008-10-28 Thread Doug Farrell
where I create the engine and the first session object. All other modules reference this module to create their own session objects. By the way, with locally scoped session variables should I do a session.close() or not? Thanks, Doug -Original Message- From: sqlalchemy@googlegroups.com

[sqlalchemy] InvalidRequestError and ConcurrentModification problems

2008-10-27 Thread Doug Farrell
the traceback of the exception I'm getting. Any help would be appreciated. Thanks, Doug 2008-10-27 18:15:54 srsmanager ERRORunexpected error, restarting: Traceback (most recent call last): File c:\cygwin\home\ripadmin\dev\srsmanager\srsprocess.py, line 154, in runjobs isActive = self

[sqlalchemy] Can't attach instance; another instance with key (?)

2008-10-10 Thread Doug Farrell
these exceptions: Can't attach instance [EMAIL PROTECTED]; another instance with key (, (220,)) is already present in this session. What is this trying to tell me? Does this mean that a newly created job is trying to use the primary key of an already existing job? Thanks in advance for your help! Doug

[sqlalchemy] How to perform inner joins

2008-09-26 Thread Doug Farrell
the results I want from the MySQL command line against the existing tables in the database, but I can't figure out how to construct an equivalent SqlAlchemy version to do the same thing passing in 'A' as the paramter. I know I'm being dense about this, thanks in advance for the help, Doug

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
on your further, how can I get the 'type' field that is defined as a column in the press_routing_press linking table that goes with everyting that comes back with PressRouting.code=='A' ? Again, thanks for your help and patience, I've been using Python for awhile, but I'm a DB novice... Doug

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
about using the Association Object, but haven't figured it out yet. I've gotten back lots of data, just not the limited set I'm looking fore. Thanks, Doug From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bayer Sent: Friday, September 26, 2008 4:10 PM

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
Michael, After some tweaking around, it works! Thanks for all your help, it was invaluable! I'm sure I'll be back for more though... J Doug From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bayer Sent: Friday, September 26, 2008 5:50 PM To: sqlalchemy

[sqlalchemy] Re: Newbie many-to-many using Declarative question

2008-09-25 Thread Doug Farrell
really appreciate your attention to my issues! Thanks again, Doug --~--~-~--~~~---~--~~ 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

[sqlalchemy] How to perform inner joins

2008-09-25 Thread Doug Farrell
against the existing tables in the database, but I can't figure out how to construct an equivalent SqlAlchemy version to do the same thing passing in 'A' as the paramter. I know I'm being dense about this, thanks in advance for the help, Doug --~--~-~--~~~---~--~~ You

[sqlalchemy] Newbie many-to-many using Declarative question

2008-09-24 Thread Doug Farrell
exceptions. From what I've read the above code looks closest to something that should work based on what I've seen others posting. Any help and/or guidance would be appreciated, thanks! Doug --~--~-~--~~~---~--~~ You received this message because you are subscribed

[sqlalchemy] Re: ORM mapping existing data tables

2008-09-22 Thread Doug Farrell
Michael, Thanks for the response and help, I made the change and the class is populated, this is great! Again, thanks for your help, Doug -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Bayer Sent: Sunday, September 21, 2008 10:41

[sqlalchemy] ORM mapping existing data tables

2008-09-21 Thread Doug Farrell
Mapper|MyTable|mytable could not assemble any primary key columns for mapped table 'mytable' What is this error message trying to tell me? Thanks in advance, Doug --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: Problem with coverage and sqlalchemy declarative synonym?

2008-09-18 Thread Doug Latornell
With some help from Ned Batchelder I was able to confirm that this is a Python bug: http://bugs.python.org/issue1569356 that has been fixed since the 2.5.2 release. Ned confirmed that the fix is included in Python 2.6a3. Doug On Sep 16, 5:22 pm, Doug Latornell [EMAIL PROTECTED] wrote: Thanks

[sqlalchemy] Re: Declarative documentation

2008-09-17 Thread Doug Farrell
a page about eager loading. However, it was interesting reading all the same! Thanks again, Doug -Original Message- From: sqlalchemy@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Empty Sent: Wednesday, September 17, 2008 9:02 AM To: sqlalchemy@googlegroups.com Subject

[sqlalchemy] Problem with coverage and sqlalchemy declarative synonym?

2008-09-16 Thread Doug Latornell
, or with coverage not understanding what that metaclass produces, or something. Or is there something else I'm missing? Doug --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] Re: Problem with coverage and sqlalchemy declarative synonym?

2008-09-16 Thread Doug Latornell
Thanks for the quick replies, Jason and Michael, and for the very succinct test case. I will try to raise this with Ned Bachelor over at http://nedbatchelder.com/code/modules/coverage.html Doug On Sep 16, 4:55 pm, Michael Bayer [EMAIL PROTECTED] wrote: On Sep 16, 2008, at 7:25 PM, Doug