def __init__(self, data, obj, connection, env, adapter=None):
     # print data, model
     FixtureSet.__init__(self, data)
     self.env = env
     self.connection = connection
     if adapter:
         self.obj = adapter(obj)
         self.obj = obj
     ## do we add table objects?  elixir Entity classes get the Entity.table attribute
     # if self.obj.table not in self.env:
     #     self.env.add_table(self.obj.table)
     self.primary_key = None
     self.data_dict = {}
     for col in self.obj.columns:
         sendkw = {}
         for fk in col.foreign_keys:
             sendkw['foreign_key'] = fk
         val = self.get_col_value(, **sendkw)
         self.data_dict[] = val
Beispiel #2
    def __init__(self, data, model, connection=None):
        FixtureSet.__init__(self, data)
        self.connection = connection
        self.model = model
        self.meta = model.sqlmeta
        self.foreign_key_class = {}
        self.primary_key = None


        # NOTE: primary keys are not included in columnList
        # so we need to find it ...

        cols = []
        cols.extend([self.attr_to_db_col(c) for c in self.meta.columnList])

        # even though self.meta.idName tells us the real col name, when
        # accessing object properties sqlobject wants you to say,
        # for which it proxies the real id column name
        vals = [getattr(, 'id')]
        vals.extend([self.get_col_value( for c in self.meta.columnList])

        self.data_dict = dict(zip(cols, vals))