# Custom Data Driven Provider is showing stale tags

**URL:** <https://forum.inductiveautomation.com/t/custom-data-driven-provider-is-showing-stale-tags/4108>\
**Category:** Ignition\
**Created:** [March 6, 2012, 7:26pm UTC](https://forum.inductiveautomation.com/t/custom-data-driven-provider-is-showing-stale-tags/4108 "2012-03-06T19:26:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg.Buehler](https://avatars.discourse-cdn.com/v4/letter/g/ecc23a/32.png) [@Greg.Buehler](https://forum.inductiveautomation.com/u/Greg.Buehler)\
**Post date:** [March 6, 2012, 7:26pm UTC](https://forum.inductiveautomation.com/t/custom-data-driven-provider-is-showing-stale-tags/4108/1 "2012-03-06T19:26:51Z")

</div>

I’m looking into driving a custom driver and the values for my tags within Ignition are updating, but they are ‘stale’.

From my understanding of the custom driver whitepaper, I need to:  
[ul]  
[li]- update the tag value and the `valuechange` column to the current datetime in sqlt\_core[/li]  
[li]- update the `lastexec' to the current datetime, and`nextexec` to the current datetime plus the scan rate.[/li][/ul]

Example (python) code:

```auto
import MySQLdb, datetime, time

try:
        conn = MySQLdb.connect ( host = "localhost",
                                 user = "ignition",
                                 passwd = "password",
                                 db = "drivertest")

        cursor = conn.cursor()

        for x in range(0, 1000):
                d = datetime.datetime.now()
                now = d.strftime('%Y-%m-%d %H:%M:%S') # timestamp
                next = (d + datetime.timedelta(seconds=1)).strftime('%Y-%m-%d %H:%M:%S')
                value = x

                # update the value
                cursor.execute("UPDATE sqlt_core SET intvalue=%d, valuechange='%s' WHERE name='TestTag'" % (x, now) )
                print "set intvalue=%d" % x

                # update scan class instance
                cursor.execute("UPDATE sqlt_sci SET lastexec='%s', lastexecrate=1000, nextexec='%s'" % (now, next))

                # wait some
                time.sleep(0.1)

except MySQLdb.Error, e:
        print "err %d: %s" % (e.args[0], e.args[1])
```

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [March 7, 2012, 12:14am UTC](https://forum.inductiveautomation.com/t/custom-data-driven-provider-is-showing-stale-tags/4108/2 "2012-03-07T00:14:15Z")

</div>

Hi,

I would double check that everything is lining up linking the tag to that sci row. The tag has a scan class id and a driver name. The scan class id must map to an entry in sqlt\_sc, and then there must be an entry in that sci table for that id, and the driver name set for the tag.

Depending on the version of Ignition (I think it was put in for 7.3.5), there’s a logger for external tags meant to help track down why things are stale. Go to Console\>Levels and search for “ExternalTags”. It should be something like “…ProviderName.ExternalTags”, and if you change it to trace, it will print out stats about what it sees.

Also, this shouldn’t come into play since your db is on localhost, but the staleness will be calculated against the DB’s “CURRENT\_TIMESTAMP”, so you might want to check for a discrepancy there.

Regards,
