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

2017-09-28 Thread Doug Farrell
, September 28, 2017 at 10:54:13 AM UTC-4, Mike Bayer wrote: > > On Thu, Sep 28, 2017 at 9:29 AM, Doug Farrell <doug.f...@gmail.com > > wrote: > > Hi all, > > > > I'm having trouble understanding how to use > > session.begin(subtransactions=True) as a context ma

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

2017-09-28 Thread Doug Farrell
Hi all, I'm having trouble understanding how to use session.begin(subtransactions=True) as a context manager. I'm working in Python 2.7.5 with SQLAlchemy 1.1.14 in a Flask 0.12.2 application on CentOS 7 servers. I like session.begin() as a context manager, but things aren't working as I

[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
-to-one since you cannot have more than one ExtraStat referencing a single Stat, due to the PK constraint on ExtraStat.name. The error is raising at the point of query() since autoflush is kicking in - use session.flush() to isolate the error. On Nov 29, 2008, at 12:18 PM, Doug Farrell wrote

[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
Hi all, I'm having a problem with a new instance of a relation conflicting with an existing instance. I'm using SA 0.5rc with Sqlite3. Here are my simplified classes: class Stat(sqladb.Base): __tablename__ = stats name = Column(String(32), primary_key=True)

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

2008-11-28 Thread Doug Farrell
Hi all, I'm having a problem with a new instance of a relation conflicting with an existing instance. I'm using SA 0.5rc with Sqlite3. Here are my simplified classes: class Stat(sqladb.Base): __tablename__ = stats name = Column(String(32), primary_key=True) total=

[sqlalchemy] Re: Declarative application example

2008-10-28 Thread Doug Farrell
Michael, Thanks for your response. I'll take another look at the ORM tutorial and the Session chapter now that I've got a little experience and see if some lights go on. Your text about deleting instances matches my understanding of how things work, but it's good to get confirmation and that

[sqlalchemy] Re: InvalidRequestError and ConcurrentModification problems

2008-10-28 Thread Doug Farrell
. On Oct 27, 2008, at 9:15 PM, Doug Farrell wrote: Hi all, I'm using Python 2.5.1 with SqlAlchemy 0.5rc2 with Sqlite on Windows Server 2003 and I'm having a problem with my application throwing InvalidRequestError and ConcurrentModification exceptions. Here is my simplified

[sqlalchemy] InvalidRequestError and ConcurrentModification problems

2008-10-27 Thread Doug Farrell
Hi all, I'm using Python 2.5.1 with SqlAlchemy 0.5rc2 with Sqlite on Windows Server 2003 and I'm having a problem with my application throwing InvalidRequestError and ConcurrentModification exceptions. Here is my simplified declarative class: class Job(srsmanagerdb.Base): STATUS_INIT = 0

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

2008-10-10 Thread Doug Farrell
Hi all, I'm using SqlAlchemy 0.5rc1 to track jobs with a sqlite datatabe in a state machine used by a server. Each job represents a currently active job in the server and will be alive for awhile as it takes time for the server to process each job. When a job is done it is removed from the

[sqlalchemy] How to perform inner joins

2008-09-26 Thread Doug Farrell
Hi all, Well, I'm still stumped by SqlAlchemy syntax, but it's getting better. I've got some tables built this way using SqlAlchemy 0.5: press_table = Table('press', metadata, autoload=True) press_routing_table = Table('press_routing', metadata, autoload=True) press_routing_press_table

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
Michael, You're right of course, your version works fine. I cut and pasted what you have into my code framework, cleaned up some stuff and it works there as well. One thing I cleaned up was this: # initialize the mysql engine and SqlAlchemy base objects engine =

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Re: How to perform inner joins sess.query(Press, PressRouting.code).join(Press.routes).filter(PressRouting.code=='A').all () will return tuples in the form: (some Press object, somecode) On Sep 26, 2008, at 3:25 PM, Doug Farrell

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
@googlegroups.com Subject: [sqlalchemy] Re: How to perform inner joins On Sep 26, 2008, at 5:42 PM, Doug Farrell wrote: I'm have the 'type' column in the press_routing_press linking table; something like this: Sess.query(Press, PressRoutingPress.type).join(Press.routes).filter

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

2008-09-25 Thread Doug Farrell
Michael, class PressRoutingPress(Base): '''This class defines the many-to-many join table between press and press_routing. ''' __tablename__ = press_routing_press __table_args__ = {'autoload' : True} press_id = Column(Integer, ForeignKey('press.id'),

[sqlalchemy] How to perform inner joins

2008-09-25 Thread Doug Farrell
Hi all, Well, I'm still stumped by SqlAlchemy syntax, but it's getting better. I've got some tables built this way using SqlAlchemy 0.5: press_table = Table('press', metadata, autoload=True) press_routing_table = Table('press_routing', metadata, autoload=True) press_routing_press_table =

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

2008-09-24 Thread Doug Farrell
Hi all, I'm trying to set up a many-to-many system using the Declarative syntax against an existing MySQL set of tables. We're using a 'link' table between two other tables we want to relate many-to-many. Here's the simplified layout of those tables: mysql desc press_routing_press;

[sqlalchemy] Re: ORM mapping existing data tables

2008-09-22 Thread Doug Farrell
PM To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Re: ORM mapping existing data tables On Sep 21, 2008, at 9:09 PM, Doug Farrell wrote: Hi everyone, I'm new to SqlAlchemy, but I've got some things working and really am enjoying it. Right now I'm trying to ORM map some

[sqlalchemy] ORM mapping existing data tables

2008-09-21 Thread Doug Farrell
Hi everyone, I'm new to SqlAlchemy, but I've got some things working and really am enjoying it. Right now I'm trying to ORM map some existing MySQL database tables to a class. I've read the documentation, I guess I'm just not getting it. Can someone help me out. I've done this: # initialize the

[sqlalchemy] Re: Declarative documentation

2008-09-17 Thread Doug Farrell
Michael, Thanks for getting back to me so quickly. I've figured out how to get a one-to-many, single table relationship working with one way relations, here is that configuration: class JobData(Base): __tablename__ = jobs id = Column(Integer, primary_key=True, autoincrement=True)