def open_from_db(self, db_connection, vtType, id, lock=False):
        all_objects = {}
        global_props = {'id': id}
        # print global_props
        res_objects = self['sql'][vtType].get_sql_columns(db_connection, 
                                                          global_props,
                                                          lock)

        if len(res_objects) > 1:
            raise VistrailsDBException("More than object of type '%s' and "
                                       "id '%s' exist in the database" % \
                                           (vtType, id))
        elif len(res_objects) <= 0:
            raise VistrailsDBException("No objects of type '%s' and "
                                       "id '%s' exist in the database" % \
                                           (vtType, id))

        all_objects.update(res_objects)
        res = res_objects.values()[0]
        del global_props['id']

        for dao in self['sql'].itervalues():
            if (dao == self['sql'][DBVistrail.vtType] or
                # dao == self['sql'][DBWorkflow.vtType] or
                dao == self['sql'][DBLog.vtType] or
                dao == self['sql'][DBAbstraction.vtType]):
                continue
            current_objs = dao.get_sql_columns(db_connection, global_props, 
                                               lock)
            if dao == self['sql'][DBWorkflow.vtType]:
                for key, obj in current_objs.iteritems():
                    if key[0] == vtType and key[1] == id:
                        continue
                    elif key[0] == DBWorkflow.vtType:
                        res_obj = self.open_from_db(db_connection, key[0], 
                                                    key[1], lock)
                        res_dict = {}
                        res_dict[(res_obj.db_id, res_obj.vtType)] = res_obj
                        all_objects.update(res_dict)
            else:
                all_objects.update(current_objs)

        for key, obj in all_objects.iteritems():
            if key[0] == vtType and key[1] == id:
                continue
            self['sql'][obj.vtType].from_sql_fast(obj, all_objects)
        for obj in all_objects.itervalues():
            obj.is_dirty = False
            obj.is_new = False
        return res
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/db/versions/v0_9_4/persistence/__init__.py/DAOList.open_from_db/original