Hi

I've got a small problem with my python code proted from 0.5 (p2.5) to
0.4.6 (p2.3).
When I try to load query objects from many-to-many relation (mapped
via secondary keyword) I get most weird error:

Traceback (most recent call last):
  File "<string>", line 86, in ?
  File "X", line 17, in call_from_unix
  File "X", line 12, in test
  File "/usr/lib/python2.3/site-packages/SQLAlchemy-0.4.6-py2.3.egg/
sqlalchemy/orm/attributes.py", line 44, in __get__
    return self.impl.get(instance._state)
  File "/usr/lib/python2.3/site-packages/SQLAlchemy-0.4.6-py2.3.egg/
sqlalchemy/orm/attributes.py", line 281, in get
    return self.set_committed_value(state, value)
  File "/usr/lib/python2.3/site-packages/SQLAlchemy-0.4.6-py2.3.egg/
sqlalchemy/orm/attributes.py", line 635, in set_committed_value
    collection.append_without_event(item)
  File "/usr/lib/python2.3/site-packages/SQLAlchemy-0.4.6-py2.3.egg/
sqlalchemy/orm/collections.py", line 540, in append_without_event
    getattr(self._data(), '_sa_appender')(item, _sa_initiator=False)
AttributeError: 'InstrumentedList' object has no attribute
'_sa_appender'

Any idea what is going on? It doesn't happen with sa > 0.5

Any help will be much appreciated
Cheers

The tables look like follows:
-------------------------------------------------------------------------------------------------------------------------
import sqlalchemy;
import sqlalchemy.orm;
import rfang.model.rfablcklstinstr;
import rfang.model.rfaruntime;

t_RfaEnvironment = None;
t_RfaEnvironment_RfaBlcklstInstr = None;

def initializeTable(metadata): #{{{
    global t_RfaEnvironment;
    global t_RfaEnvironment_RfaBlcklstInstr;
    if(t_RfaEnvironment == None):
        t_RfaEnvironment = sqlalchemy.Table("RuntimeConfigType",
metadata,
            sqlalchemy.Column
("id",sqlalchemy.types.Integer,sqlalchemy.schema.Sequence
("id_RuntimeConfigType"),primary_key=True),
            sqlalchemy.Column("name",sqlalchemy.types.Unicode
(10),nullable=False,unique=True),
            sqlalchemy.Column("filename",sqlalchemy.types.Unicode
(100),nullable=False),
            sqlalchemy.Column("filtername",sqlalchemy.types.Unicode
(255),nullable=False),
            useexisting=True
        );
        rfang.model.rfablcklstinstr.initializeTable(metadata);
        t_RfaEnvironment_RfaBlcklstInstr = sqlalchemy.Table
("RuntimeConfigType_Blacklist", metadata,
            sqlalchemy.Column
("runtimeConfigType_id",sqlalchemy.types.Integer,sqlalchemy.ForeignKey
('RuntimeConfigType.id')),
            sqlalchemy.Column
("blacklist_id",sqlalchemy.types.Integer,sqlalchemy.ForeignKey
('Blacklist.id')),
            useexisting=True
        );
    return;
#def }}}

def initializeMapper(): #{{{
    global t_RfaEnvironment;
    global t_RfaEnvironment_RfaBlcklstInstr;
    sqlalchemy.orm.mapper( RfaEnvironment, t_RfaEnvironment,
properties = {
        "rfaruntimes" : sqlalchemy.orm.relation
(rfang.model.rfaruntime.RfaRuntime,backref="rfaenvironment",cascade="all,delete,delete-
orphan"),
        "rfablacklist" : sqlalchemy.orm.relation
(rfang.model.rfablcklstinstr.RfaBlcklstInstr,secondary =
t_RfaEnvironment_RfaBlcklstInstr ,backref="rfaenvironments")
    });
    return;
#def }}}

class RfaEnvironment(object):

    def __init__(self, name=None, filtername=None, filename=None,
rfaruntimes=[], rfablacklist=[]): #{{{2
        self.name = name;
        self.filename = filename;
        self.filtername = filtername;
        self.rfablacklist = rfablacklist;
        self.rfaruntimes = rfaruntimes;
        return;
    #def }}}2

#class RuntimeConfigType
-------------------------------------------------------------------------------------------------------------------------
import sqlalchemy;
import sqlalchemy.orm;
import rfang.model.rfaenvironment;
import rfang.model.rfarun;

t_RfaSuite = None;
t_RfaSuite_RfaEnvironment = None;

def initializeTable(metadata): #{{{
    global t_RfaSuite;
    global t_RfaSuite_RfaEnvironment;
    if(t_RfaSuite == None):
        t_RfaSuite = sqlalchemy.Table("RfaSuite",metadata,
            sqlalchemy.Column
("id",sqlalchemy.types.Integer,sqlalchemy.schema.Sequence
("id_RfaSuite"),primary_key=True),
            sqlalchemy.Column("name",sqlalchemy.types.Unicode
(50),nullable=False),
            useexisting=True
        );
        rfang.model.rfaenvironment.initializeTable(metadata);
        t_RfaSuite_RfaEnvironment = sqlalchemy.Table
("RfaSuite_RuntimeConfigType",metadata,
            sqlalchemy.Column
("RfaSuite_id",sqlalchemy.types.Integer,sqlalchemy.ForeignKey
("RfaSuite.id")),
            sqlalchemy.Column
("RuntimeConfigType_id",sqlalchemy.types.Integer,sqlalchemy.ForeignKey
("RuntimeConfigType.id")),
            useexisting=True
        );
    return;
#def }}}

def initializeMapper(): #{{{
    global t_RfaSuite;
    global t_RfaSuite_RfaEnvironment;
    sqlalchemy.orm.mapper(RfaSuite, t_RfaSuite, properties = {
               "rfaenvironments"   : sqlalchemy.orm.relation
(rfang.model.rfaenvironment.RfaEnvironment,secondary=t_RfaSuite_RfaEnvironment,
backref="rfasuites"),
               "rfaruns"           : sqlalchemy.orm.relation
(rfang.model.rfarun.RfaRun,backref="rfasuite",cascade="all,delete,delete-
orphan",order_by=rfang.model.rfarun.t_RfaRun.c.id)
            });
    return;
#def }}}


class RfaSuite(object):

    def __init__(self,name,rfaenvironments = [],rfaruns = []): #{{{2
        self.name = name;
        self.rfaenvironments = rfaenvironments;
        self.rfaruns = rfaruns;
        return;
    #def }}}2

# class RfaSuite

--~--~---------~--~----~------------~-------~--~----~
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...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to