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

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

[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 though

[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+unsubscr...@g

[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
ot; still holds. Your > relation > > from Stat->ExtraStat currently needs to be one-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() > s

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

2008-12-02 Thread Doug Farrell
t currently needs to be one-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

[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) to

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

2008-11-29 Thread Doug Farrell
think thats good etiquette. > > > On Nov 29, 5:22 am, "Doug Farrell" <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > I'm having a problem with a new instance of a relation conflicting > with > > an existing instance. I'm using SA

[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= C

[sqlalchemy] Re: InvalidRequestError and ConcurrentModification problems

2008-10-28 Thread Doug Farrell
royed/shared among threads) as well as what other > concurrency exists within this section of the application. > > 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 Windo

[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 I'm

[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] recreating objects from a database

2008-10-22 Thread Doug Farrell
Hi all, I'm using SqlAlchemy 0.5rc2 on a Windows Server 2003 system and I've got a question about re-creating objects from a database. I'm building a Windows Service using Python and the win32all modules and using SA to save the state machine data for each of the Job objects I'm tracking in a col

[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 sy

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
sqlalchemy@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).

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
Bayer Sent: Friday, September 26, 2008 4:10 PM 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

[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 = create_engine(__config__.da

[sqlalchemy] Re: How to perform inner joins

2008-09-26 Thread Doug Farrell
om Subject: [sqlalchemy] Re: How to perform inner joins On Sep 26, 2008, at 9:23 AM, Doug Farrell wrote: I'm trying to represent a many-to-many relationship between the press_table and the press_routing table using the linking table, press_routing_press. I think I've got the table

[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] 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 = Table('

[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('pre

[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
ber 21, 2008 10:41 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 g

[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] sqlite: copy from one database to another

2008-09-17 Thread Doug Farrell
Hi all, I'm using SqlAlchemy with Sqlite to maintain a dynamic state table for a constantly running process. The table for this is kept in memory using the create_engine('sqlite:///:memory:') function call. My process is an endlessly running loop (with a sleep state), and I'd like to read the dat

[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)