Database History Tag Confusion

Tried to set up the click to graph goodie but ran into problems, mostly my lack of understanding the db schema. Found that the bulk pen creation history tag selector, in the click to graph, was displaying tags that were not selected as a history tag. I’m a little confused as why those tags showed up in the list. I went ahead and deleted the tags from the sqlth-te tables. How do I reload the tags? When does the history tags get loaded into the database? I created a new db and didn’t find the tables ( sqlth_partition, _sce, _drv, _scinfo, and _te) listed.

Reloaded the csv and it appeared in the db sqlth_te. Don’t know if I’m seeing things or not. Read several posts on the sqlth but still would like reassurance like when are these tables created, loaded etc.

The sqlth_* tables are created as needed.
That is, if they don’t exist when a tag is written to the historydb, the are first created and then the tag is written.

If a tag is listed in the sqlth_te table, it’s because there is a least one history point for that tag. The point could be a simple as a change in quality.

I can’t say exactly what was going on with the click to graph system, but I can offer some info on how the tag table works:

The “sqlth_te” table maps the tag path to an integer id, which is used by the data tables. Tags are inserted in that table the first time data is stored for them. However, the resulting key is cached. So, when you delete the values from that table, data might still be stored for a while before you see a new entry come in.

The problem is, when the new entry is made, the tag path will now be associated with a new id. That means all of your old data won’t line up any more. You would have to change the id in the “te” table to match the old id, or change the ids in the data table. It’s ok to have the same tag path listed with multiple ids, so you could also just insert a row with the old id. No matter what, though, it’s tricky, because you probably don’t know the old id.

Regards,