<class 'sqlalchemy.exceptions.FlushError'>: instance Location is an
unsaved, pending instance and is an orphan (is not attached to any
parent 'Host' instance via that classes' 'location' attribute, nor any
parent 'User' instance via that classes' 'location' attribute)

I have three tables: Host, User and Location
Host and User have a Location as a relation using the 'location' attribute.

In a specific piece of code, I wanted to just create a new Location
(which is not associated with any User or Host table), so I did:

location = model.Location(ip.lat, ip.lon)
location.ip = ip_integer
location.address = ", ".join((ip.city, ip.country))
location.code = ip.code

model.Session.save(location)
model.Session.commit()

That spits out that FlushError.  The odd thing is, I am using the same
code in another environment (beta) and it seems to work. When I put
the code on my production server, it fails with this.

Is this supposed to work? BTW, this is beta 5.

--~--~---------~--~----~------------~-------~--~----~
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