Re: [sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Michael Naber
(instance)? My objective is that I would want to have full access to access and modify the instance in the session of the receiving thread. Thank you, Michael On Tue, Feb 16, 2016 at 11:26 AM, Mike Bayer <clas...@zzzcomputing.com> wrote: > answered > > > > On 02/16/2016 09:08 AM

[sqlalchemy] How to correctly merge objects of type X or any subclass of type X into the session?

2016-02-16 Thread Michael Naber
I would like to write code which can correctly merge objects of type X or any subclass of type X into the session. I have been doing session.merge(X(id=??)), which works fine for merging type X, but if the object ID references an instance of any subclass of X, the merge results in the

[sqlalchemy] SQLAlchemy under Jython fails with Maximum Recursion Depth Exceeded

2015-10-06 Thread Michael Naber
Hopefully this should be pretty straightforward. I'm running the following example which fails under Jython 2.7.0 with postgresql-9.4-1203.jdbc42.jar using sqlalchemy 1.0.8 with PostgreSQL 9.3.9 on Ubuntu 14.04. Any help would be much appreciated. Example and stack trace below: from sqlalchemy

[sqlalchemy] Re: SQLAlchemy under Jython fails with Maximum Recursion Depth Exceeded

2015-10-06 Thread Michael Naber
It could be due to this: http://sourceforge.net/p/jython/mailman/message/34131065/ On Tue, Oct 6, 2015 at 11:35 AM, Michael Naber <mickey...@gmail.com> wrote: > Hopefully this should be pretty straightforward. I'm running the following > example which fails under Jython 2.7.0 with po

[sqlalchemy] Versioning of Many-to-Many relationships

2012-02-09 Thread Michael Naber
*I have a many to many relationship between musician and genre indicating that a particular musician performs in the style of a particular genre: Musician -- musician_genre -- Genre Musician and Genre are both versioned using VersionedMeta so it is easy for me to display a history of the

[sqlalchemy] Question about mutable primary keys and foreign keys

2012-02-06 Thread Michael Naber
I am trying to efficiently update all things that foreign key to a particular record so that they instead foreign key to a different record. I provided an example that illustrates the problem I am trying to solve. Please see my question at the bottom of the code. Thanks for your help, Michael

Re: [sqlalchemy] Simple question about delete-orphan

2011-11-19 Thread Michael Naber
On Tue, Nov 1, 2011 at 11:00 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Nov 1, 2011, at 6:48 AM, Michael Naber wrote: Quick question: Why am I allowed to persist an address with no person_id? Shouldn't the delete-orphan prohibit this? This was the behavior up until 0.7, when

[sqlalchemy] Simple question about delete-orphan

2011-11-01 Thread Michael Naber
Quick question: Why am I allowed to persist an address with no person_id? Shouldn't the delete-orphan prohibit this? Thanks, Michael from sqlalchemy import Column, Integer, String, ForeignKey, create_engine from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import

Re: [sqlalchemy] Bug in mssql dialect?

2011-03-04 Thread Michael Naber
, Michael Naber wrote: Last line is invalid t-sql. The ‘==’ should just be ‘=’. I get the problem when using mssql but not with sqlite. Saw the bug on sqa version 0.6.6, upgraded to 0.7b2 and still having issue. Please let me know if you need more info and I'll be happy to provide

[sqlalchemy] Bug in mssql dialect?

2011-03-03 Thread Michael Naber
Last line is invalid t-sql. The ‘==’ should just be ‘=’. I get the problem when using mssql but not with sqlite. Saw the bug on sqa version 0.6.6, upgraded to 0.7b2 and still having issue. Please let me know if you need more info and I'll be happy to provide. Thanks, Michael Traceback (most

[sqlalchemy] Using the foreign_keys relationship argument with declarative

2011-02-11 Thread Michael Naber
If I'm creating a relationship to a class MyRelatedClass using declarative syntax, and I need to assign a column from MyRelatedClass to the foreign_keys argument, it seems I have to say foreign_keys=[MyRelatedClass.__mapper__.c.relate_id]. Is there any way to just do something in the declarative

Re: [sqlalchemy] Re: Using the foreign_keys relationship argument with declarative

2011-02-11 Thread Michael Naber
(20)) here a_id column of b_table is foreignkey related to the id column of a_table On Feb 11, 9:20 am, Michael Naber mickey...@gmail.com wrote: If I'm creating a relationship to a class MyRelatedClass using declarative syntax, and I need to assign a column from MyRelatedClass

[sqlalchemy] Adjacency List Relationship in a Child Class

2011-01-23 Thread Michael Naber
= Column(Integer, ForeignKey('department.id')) parent_department = relationship(Department, backref=backref(subdepartments), remote_side=id) Thanks, Michael Naber -- You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Adjacency List Relationship in a Child Class

2011-01-18 Thread Michael Naber
appreciate any insight. Thanks, Michael Naber from sqlalchemy.orm import scoped_session, sessionmaker, relationship, backref from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Text, Date Session = scoped_session