# Creating your own SQLTags driver

**URL:** <https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677>\
**Category:** General Discussion\
**Created:** [March 22, 2010, 4:24pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677 "2010-03-22T16:24:42Z")\
**Posts on this page:** 14\
**Page:** 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 22, 2010, 4:24pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/1 "2010-03-22T16:24:42Z")

</div>

For programmers looking to make outside real-time data available to Ignition, SQLTags provide a great extension point. Since the tags are stored in an open format in the database, developers can model their data as SQLTags and then take advantage of everything they offer in Ignition- drag and drop UI config, status overlays, etc.

We’ve created a basic whitepaper that outlines the fundamentals of how to create your own “SQLTags Driver”. The goal of the paper is to get developers up and running, driving simple tags with their own data.

The paper is available here: [SQLTags Custom Driver Guide](http://files.inductiveautomation.com.s3.amazonaws.com/guides/sqltags_custom_driver_guide.pdf)

Attention: This paper is directed towards developers looking to extend Ignition. Normal users, even those utilizing advanced features and scripting, are not the intended audience.

---

<div class="post-metadata">

**Author:** ![bryan\_cook](https://avatars.discourse-cdn.com/v4/letter/b/a8b319/32.png) [@bryan\_cook](https://forum.inductiveautomation.com/u/bryan_cook)\
**Post date:** [March 22, 2010, 6:30pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/2 "2010-03-22T18:30:11Z")

</div>

Wow, thanks!

---

<div class="post-metadata">

**Author:** ![ISDProj](https://avatars.discourse-cdn.com/v4/letter/i/58956e/32.png) [@ISDProj](https://forum.inductiveautomation.com/u/ISDProj)\
**Post date:** [March 22, 2010, 9:14pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/3 "2010-03-22T21:14:43Z")

</div>

![:thumb_right:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/2026e28c0c425034352c1b75807edf956adc75f4.gif ":thumb\_right:") Great stuff ![:thumb_left:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/e26afb081ddde6df016df6ee49159cf56aaca688.gif ":thumb\_left:")

Thanks - yet another example of the outstanding service you Guys are providing!

Peter

---

<div class="post-metadata">

**Author:** ![todd.be](https://avatars.discourse-cdn.com/v4/letter/t/6f9a4e/32.png) [@todd.be](https://forum.inductiveautomation.com/u/todd.be)\
**Post date:** [March 26, 2010, 12:16am UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/4 "2010-03-26T00:16:32Z")

</div>

We have already implemented a customer driver along these lines and it works reasonably well for us. We were probably one of the groups you wrote up something like this for before and we thank you for that. The problem I have right now and maybe I’ve overlooked something was in relation to the sqlt\_wq table. How does one control now long a write request can be queued in the table and pending before the write is abandoned and error is displayed.

Currently it seems to be set to 10 seconds or so but we have instances where we do not get success code back from the device in time to avoid issues with it believing the transaction abandoned and the hmi displays write timed out. In most cases the time is adequate but we dont necessarily want our operators trying again or getting confused about he error if it eventually does succeed. We do actually ignore subsequent write attempts if one is already active but no good way to provide that feedback after the hmi has aborted the attempt.

Anyway, is this write timeout configurable somewhere? Pretty sure its not the “Fallback Delay” on property bindings.

---

<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 26, 2010, 1:17am UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/5 "2010-03-26T01:17:36Z")

</div>

Hi,

Yes, I had worked with a member of your company a while ago to get you guys started on that. Glad to hear it’s worked out so far.

That particular timeout is strangely not a settable option. I believe that in FactoryPMI it was set to 15 seconds, but has been increased to 30 seconds in Ignition. If 30 seconds still isn’t enough, I can create a ticket to make it into a settable option.

Regards,

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [March 26, 2010, 7:44pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/6 "2010-03-26T19:44:03Z")

</div>

Gone all week and this is waiting for me when I get back 😃

Thank you. Off to create some db tables…

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [April 1, 2010, 3:35pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/7 "2010-04-01T15:35:47Z")

</div>

Quick note: The table definition for the sqlt\_as table is missing the tagid column

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://forum.inductiveautomation.com/u/Robert)\
**Post date:** [April 16, 2010, 3:31pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/8 "2010-04-16T15:31:08Z")

</div>

Hi Colby,

What indexes are required on these tables?

---

<div class="post-metadata">

**Author:** ![gnguyen](https://avatars.discourse-cdn.com/v4/letter/g/41988e/32.png) [@gnguyen](https://forum.inductiveautomation.com/u/gnguyen)\
**Post date:** [September 4, 2012, 3:15pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/9 "2012-09-04T15:15:28Z")

</div>

Hi,

Any updated document available with wq table etc. ? or a sample project with db ?

Thank you

---

<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:** [September 4, 2012, 4:18pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/10 "2012-09-04T16:18:23Z")

</div>

The latest version of the Programmer’s Guide in the Module SDK (7.5.2) has a section describing the tables, as well as the historical tables.

I don’t believe it describes the indexes, however. For the write queue, only the t\_stamp column needs an index.

Regards,

---

<div class="post-metadata">

**Author:** ![tombrzezinski](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tombrzezinski](https://forum.inductiveautomation.com/u/tombrzezinski)\
**Post date:** [August 11, 2014, 9:07pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/11 "2014-08-11T21:07:48Z")

</div>

Hi,

I’ve followed the instructions in the ‘SQLTags Custom Driver Guide’ and am updating the value of a tag using the following SQL executing every second:

UPDATE `sqlt_core` SET `floatvalue`=second(curtime()),`valuechange`=now()  
WHERE `name`= ‘MemTag\_ND1’;  
UPDATE `sqlt_sci` SET `lastexec`=now(),`lastexecrate`=1000,`nextexec`=ADDTIME(now(),‘0 0:0:1’) WHERE `sc_id`=2;

The tag’s quality is ‘Good’, but alarms are not being generated when the value exceeds the setpoint  
(AlarmActiveAckCount and AlarmActiveUnackCount remain zero).

Is there anything else I need to do?

I am using a MySQL and a non-driving provider.

Thanks!

---

<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:** [August 11, 2014, 9:48pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/12 "2014-08-11T21:48:06Z")

</div>

Hi,

Unfortunately that’s not quite how it works- if Ignition isn’t driving the tag, it doesn’t “drive” any of it, including the alarms.

If you want to set up an alarm off a tag driven by your value, you probably have two options: 1) Switch to an driving provider or internal provider and switch the tag to an expression tag, with the value generated by the expression or 2) Switch this to a driven provider and update the value by writing to the sqlt\_wq table.

Regards,

---

<div class="post-metadata">

**Author:** ![tombrzezinski](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@tombrzezinski](https://forum.inductiveautomation.com/u/tombrzezinski)\
**Post date:** [August 13, 2014, 8:23pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/13 "2014-08-13T20:23:53Z")

</div>

Hi Colby,

Thanks a million for the help - alarms are now working.

FYI the SQL I used to test this was:

INSERT INTO `sqlt_wq`(`tagid`,`floatvalue`, `typeclass`, `responsecode`, `t_stamp`) VALUES  
(2,SECOND(CURTIME()),5,2,NOW());

Presumably if alarms work then notifications should work too?

And just one more question: Do I need to write something to delete rows in sqlt\_wq once they  
have been processed? (I’m assuming this is indicated by a responsecode of 1.)

Thanks & Regards,

---

<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:** [August 13, 2014, 9:26pm UTC](https://forum.inductiveautomation.com/t/creating-your-own-sqltags-driver/1677/14 "2014-08-13T21:26:49Z")

</div>

Hi,

Yes, notifications should now work. You shouldn’t need to delete the rows, unless you want to- the system should delete them every 10 minutes or so (in reality it might be a little longer, because it checks every 10 minutes, and deletes rows older than 10 minutes).

Regards,
