Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Lyla Fischer
Awesome! Thanks! -Lyla On Mon, Apr 29, 2019 at 1:55 PM Mike Bayer wrote: > On Mon, Apr 29, 2019 at 1:37 PM Lyla Fischer wrote: > > > > Ah. I think that I have been thinking of a session as a cache instead of > a transaction, which is incorrect. (It's similar because you have to worry > about

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Mike Bayer
On Mon, Apr 29, 2019 at 1:37 PM Lyla Fischer wrote: > > Ah. I think that I have been thinking of a session as a cache instead of a > transaction, which is incorrect. (It's similar because you have to worry > about persistence in the face of failures, but not-similar, because you're > not

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Lyla Fischer
Ah. I think that I have been thinking of a session as a cache instead of a transaction, which is incorrect. (It's similar because you have to worry about persistence in the face of failures, but not-similar, because you're not worried about communication with other processes. That is, a commit is

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Mike Bayer
On Mon, Apr 29, 2019 at 12:04 PM Lyla Fischer wrote: > > Sorry about the language. I'll try to stick to "intuitive" and "surprising" > in the future. > > I guess that I am familiar enough with the concept that something needs to > persist in the database before it can be referenced in the

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Lyla Fischer
Sorry about the language. I'll try to stick to "intuitive" and "surprising" in the future. I guess that I am familiar enough with the concept that something needs to persist in the database before it can be referenced in the database that I was surprised when an object was already in the database

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Mike Bayer
On Mon, Apr 29, 2019 at 7:22 AM Lyla Fischer wrote: > > If I can comment on what seems instinctive to someone who just recently read > the documentation, and made assumptions based off of it: My understanding was > that the relationship abstractions were supposed to be about making foreign >

Re: [sqlalchemy] Possible regression?

2019-04-29 Thread Lyla Fischer
If I can comment on what seems instinctive to someone who just recently read the documentation, and made assumptions based off of it: My understanding was that the relationship abstractions were supposed to be about making foreign keys easier to keep track of, and being able to go both ways on a

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread James Fennell
Thanks for the explanation Mike! Seeing it now, I actually think there’s a decent reason to want the current backerefs: My understanding is that with session.merge in SQL Alchemy it’s possible to draw a very clean line between entities that are persisted (or about to be persisted on the next

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread Lyla Fischer
I just tried it again, and it works. Sorry for the confusion. Knowing myself, I misspelled something when I tried it the first time. -Lyla On Sun, Apr 28, 2019 at 9:57 PM Mike Bayer wrote: > On Sun, Apr 28, 2019 at 9:17 PM wrote: > > > > Thanks for the quick responses, and for adding the

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread Mike Bayer
On Sun, Apr 28, 2019 at 9:17 PM wrote: > > Thanks for the quick responses, and for adding the warning for others! > > I tried adding the lines as suggested ( > > head = relationship("Head", backref="tassel_threads", cascade_backrefs=False) > > , but I keep getting the same error. with the

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread lylafisch
Thanks for the quick responses, and for adding the warning for others! I tried adding the lines as suggested ( head = relationship("Head", backref="tassel_threads", cascade_backrefs=False ) , but I keep getting the same error. I also tried cascade=None, as James suggested, but that seemed

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread Mike Bayer
the next 1.3 release will include a warning for this case, whether or not the primary key on the transient object is set up or not; it does a double insert in any case otherwise. It's just when the primary key is already present, the double insert fails on the primary key constraint.

Re: [sqlalchemy] Possible regression?

2019-04-28 Thread Mike Bayer
Hi there, I appreciate everyone chiming in to look at this! However, it's something simple and has to do with one of the API quirks that we have to decide if we want to keep long term. Background is at https://docs.sqlalchemy.org/en/13/orm/cascades.html#backref-cascade. Basically, when you do

[sqlalchemy] Possible regression?

2019-04-28 Thread lylafisch
Hi! I recently came across some confusing behavior in relations and cascading using sqllite, and I was hoping that I might get some help explaining what the behavior is here. I put together a minimum failing script here. I'm trying to commit one instance of each of two classes, but what ends

[sqlalchemy] Possible regression from 0.7.9 to 0.8.0

2013-05-13 Thread Gerald Thibault
I have the following code: from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import Session, relationship, backref e = create_engine('sqlite:tmp/test.db', echo=True) Base = declarative_base() Base.metadata = MetaData(e) class Node(Base):

Re: [sqlalchemy] Possible regression from 0.7.9 to 0.8.0

2013-05-13 Thread Michael Bayer
this is a reopen of http://www.sqlalchemy.org/trac/ticket/2481, and is fixed again in r7699a1080742. Thanks for the report. On May 13, 2013, at 3:18 PM, Gerald Thibault dieselmach...@gmail.com wrote: I have the following code: from sqlalchemy import * from sqlalchemy.ext.declarative