# Datasets not equal but no differences found?

**URL:** <https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733>\
**Category:** Ignition\
**Tags:** ignition79, vision\
**Created:** [January 18, 2023, 3:26pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733 "2023-01-18T15:26:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 18, 2023, 3:26pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/1 "2023-01-18T15:26:14Z")

</div>

I have to rewrite some stored procedures so I am writing a test to make sure for every input I am getting the same output.

I have something like

```auto
from com.inductiveautomation.common.util import DatasetTestUtils

def testSP():
    orig_call = system.db.createSProcCall('orginalSP')
    system.db.execSProcCall(orig_call)
    new_call = system.db.createSProceCall('newSP')
    system.db.execSProcCall(new_call)
    orig_data = orig_call.getResultSet()
    new_data = new_call.getResultSet()
    comparison = DatasetTestUtils.equals(orig_data, new_data)
    print str(comparison)
    return orig_data, new_data

# another func 
def compareDS(ds1, ds2):
    pyDs1 = set(tuple(row) for row in system.dataset.toPyDataSet(ds1))
    pyDs2 = set(tuple(row) for row in system.dataset.toPyDataSet(ds2))
    print 'in original but not new'
    print pyDs1 - pyDs2
    print 'in new but not original'
    print pyDs2 - pyDs1

orig_data, new_data = testSP()
comapreDS(orig_data, new_data)

```

Print ds1/ds2 shows the same number of rows and columns. `str(comparison)` is false but @pturmel forsaw the future before I even finished writing the post so that's explainable.

I copied `compareDS` from @JordanCClark and both print statements show me an empty set - it seems like it should work.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 18, 2023, 3:30pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/2 "2023-01-18T15:30:11Z")

</div>

The basic equality check for objects is "sameness", not content. You'll need to use Paul's module.

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [January 18, 2023, 3:31pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/3 "2023-01-18T15:31:17Z")

</div>

Will Paul's module work for 7.9?

Will probably have to write your own checks to determine equality.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [January 18, 2023, 3:32pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/4 "2023-01-18T15:32:38Z")

</div>

Oooh, no. Missed that tag.

I suppose you can look at how Paul's module does it and replicate it yourself. Whether in a real module or some jython.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 18, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/5 "2023-01-18T15:34:03Z")

</div>

Amazed you called that after I accidentally made the post only halfway through.

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [January 18, 2023, 3:37pm UTC](https://forum.inductiveautomation.com/t/datasets-not-equal-but-no-differences-found/68733/6 "2023-01-18T15:37:57Z")

</div>

By sameness you mean two variables referring to the same object, not sameness in terms of the dataset shape (columns/ rows/ column names).

Edit: Just tested it this seems to be the case.

I guess then my `compareDS` function will do the heavy lifting of comparing, it seems a very reasonable way to do it.
