Exemplo n.º 1
0
    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)
        else:
            self.obj = obj
        self.primary_key = None

        self.data_dict = {}
        for col in self.obj.columns:
            sendkw = {}
            if col.foreign_key:
                sendkw['foreign_key'] = col.foreign_key

            val = self.get_col_value(col.name, **sendkw)
            self.data_dict[col.name] = val
Exemplo n.º 2
0
 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
     
     self.understand_columns()
     
     # NOTE: primary keys are not included in columnList
     # so we need to find it ...
     
     cols = [self.meta.style.idForTable(self.meta.table)]
     cols.extend([self.attr_to_db_col(c) for c in self.meta.columnList])
 
     vals = [getattr(self.data, self.meta.idName)]
     vals.extend([self.get_col_value(c.name) for c in self.meta.columnList])
 
     self.data_dict = dict(zip(cols, vals))
Exemplo n.º 3
0
 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)
     else:
         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(col.name, **sendkw)
         self.data_dict[col.name] = val
Exemplo n.º 4
0
    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)
        else:
            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(col.name, **sendkw)
            self.data_dict[col.name] = val
Exemplo n.º 5
0
    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

        self.understand_columns()

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

        cols = [self.meta.style.idForTable(self.meta.table)]
        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 object.id,
        # for which it proxies the real id column name
        vals = [getattr(self.data, 'id')]
        vals.extend([self.get_col_value(c.name) for c in self.meta.columnList])

        self.data_dict = dict(zip(cols, vals))
Exemplo n.º 6
0
 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
     
     self.understand_columns()
     
     # NOTE: primary keys are not included in columnList
     # so we need to find it ...
     
     cols = [self.meta.style.idForTable(self.meta.table)]
     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 object.id,
     # for which it proxies the real id column name
     vals = [getattr(self.data, 'id')]
     vals.extend([self.get_col_value(c.name) for c in self.meta.columnList])
 
     self.data_dict = dict(zip(cols, vals))