任何有效的解决方案

时间:2019-02-06 11:32:30

标签: oracle plsql duplicates

KeyError 
Traceback (most recent call last) <ipython-input-66-b19082c2666b> in <module>
      7   image_np_expanded = np.expand_dims(image_np, axis=0)
      8   # Actual detection.
----> 9   output_dict = run_inference_for_single_image(image_np, detection_graph)
     10   # Visualization of the results of a detection.
     11   vis_util.visualize_boxes_and_labels_on_image_array(

<ipython-input-65-f22e65a052c1> in run_inference_for_single_image(image, graph)
     29         tensor_dict['detection_masks'] = tf.expand_dims(
     30             detection_masks_reframed, 0)
---> 31       image_tensor = tf.get_default_graph().get_tensor_by_name('image_tensor:0')
     32 
     33       # Run inference

D:\anaconda\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\framework\ops.py in get_tensor_by_name(self, name)    3664       raise TypeError("Tensor names are strings (or similar), not %s." %    3665   type(name).__name__)
-> 3666     return self.as_graph_element(name, allow_tensor=True, allow_operation=False)    3667     3668   def
_get_tensor_by_tf_output(self, tf_output):

D:\anaconda\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\framework\ops.py in as_graph_element(self, obj, allow_tensor, allow_operation)    3488  3489     with self._lock:
-> 3490       return self._as_graph_element_locked(obj, allow_tensor, allow_operation)    3491     3492   def _as_graph_element_locked(self, obj, allow_tensor, allow_operation):

D:\anaconda\envs\tensorflow_cpu\lib\site-packages\tensorflow\python\framework\ops.py in _as_graph_element_locked(self, obj, allow_tensor, allow_operation)  3530           raise KeyError("The name %s refers to a Tensor which does not "    3531                          "exist. The operation, %s, does not exist in the "
-> 3532                          "graph." % (repr(name), repr(op_name)))    3533         try:    3534           return op.outputs[out_n]

KeyError: "The name 'image_tensor:0' refers to a Tensor which does not exist. The operation, 'image_tensor', does not exist in the graph."

我有三个表Employee(eid,ename),Address(aid,country,state,city,streetaddress,locality,houseNo)和一个关系表(M2M)对多表employee_add(eid,aid),

我想从地址表和employee_add表中删除重复项而不会丢失数据

1 个答案:

答案 0 :(得分:0)

假设这是一次重复数据删除,您可以:

  1. 根据与员工相关的当前地址创建一组新的临时eid <->援助关系,并始终选择具有匹配数据的最小地址记录(这就是您在上面所做的事情)
  2. 删除现有的eid <->援助关系
  3. 插入步骤1中的新关系,删除步骤1数据
  4. 删除不再有任何员工的地址

这样的事情(未经演示,因为您没有提供任何DDL或DML来创建可用的示例):

//POST Edit page

router.post('/edit-page/:slug', function(req, res) {
  req.checkBody('title', 'Title must have a vlaue.').notEmpty();
  req.checkBody('content', 'Content must have a value.').notEmpty();

  var title = req.body.title;
  var slug = req.body.slug.replace(/\s+/g, '-').toLowerCase();
  if (slug == "") slug = title.replace(/\s+/g, '-').toLowerCase();

  var content = req.body.content;
  var id = req.body.id;
  var errors = req.validationErrors();

  if (errors) {
    res.render('admin/edit_page', {
      errors: errors,
      title: title,
      slug: slug,
      content: content,
      id: id

    });
  } else {
    Page.findOne({
      slug: slug,
      _id: {
        '$ne': id
      }
    }, function(err, page) {
      if (page) {
        req.flash('danger', 'Page slug exists, choose another.');
        res.render('admin/edit_page', {
          title: title,
          slug: slug,
          content: content,
          id: id

        });

      } else {
        console.log("I am this far...")
        page.findById(id, function(err, page) {

          if (err)
            console.log("How about here?");
          return console.log(err);
          page.title = title;
          page.slug = slug;
          page.content = content;

          page.save(function(err) {
            if (err)
              return console.log(err);
            req.flash('success', 'Page added!');
            res.redirect('/admin/pages/edit-page/' + page.slug);

          });
        });


      }

    });

  }


});

您还可以更改第2步和第3步,以删除现有的employee_add表,并将employee_add_new重命名为employee_add,但是我不知道您的表结构是什么样(列,FK,索引等)。