# Help Printing name of Tag?

**URL:** <https://forum.inductiveautomation.com/t/help-printing-name-of-tag/14084>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [April 19, 2017, 4:15pm UTC](https://forum.inductiveautomation.com/t/help-printing-name-of-tag/14084 "2017-04-19T16:15:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nwrner](https://avatars.discourse-cdn.com/v4/letter/n/c2a13f/32.png) [@nwrner](https://forum.inductiveautomation.com/u/nwrner)\
**Post date:** [April 19, 2017, 4:15pm UTC](https://forum.inductiveautomation.com/t/help-printing-name-of-tag/14084/1 "2017-04-19T16:15:06Z")

</div>

Any tips on how to call the name of a tag?

I am attempting to write a Gateway Event Script that writes the contents of a tag to a MySQL database. I want to write the name of the tag and its value when the tag’s value exceed 90.

**My script so far looks like this:**

```python
qv=system.tag.read("Power")

system.db.runPrepUpdate("INSERT INTO users (Name,Overage) VALUES (?,?);", [qv.name, qv.value], 'python')

```

**However, when this script is run, it gives me the following error:**

```java
Traceback (most recent call last):
  File "<event:actionPerformed>", line 6, in <module>
AttributeError: 'com.inductiveautomation.ignition.common.sqltags.Ba' object has no attribute 'name'

Ignition v7.9.1 (b2017012511)
Java: Oracle Corporation 1.8.0_111

```

Writing to MySQL with qv.value works without a problem.

Thanks!

---

<div class="post-metadata">

**Author:** ![MMaynard](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mmaynard/32/3366_2.png) [@MMaynard](https://forum.inductiveautomation.com/u/MMaynard)\
**Post date:** [April 19, 2017, 4:29pm UTC](https://forum.inductiveautomation.com/t/help-printing-name-of-tag/14084/2 "2017-04-19T16:29:31Z")

</div>

> [@nwrner](#):
>
> qv=system.tag.read("Power")
> 
> system.db.runPrepUpdate("INSERT INTO users (Name,Overage) VALUES (?,?);", [qv.name, qv.value], 'python')

You will need to do a second read for the tag name.

qvName = system.tag.read("Power.name")

You can specify any of the Tag Attributes this way.

[https://docs.inductiveautomation.com/display/DOC79/Tag+Attributes](https://docs.inductiveautomation.com/display/DOC79/Tag+Attributes)

---

<div class="post-metadata">

**Author:** ![nwrner](https://avatars.discourse-cdn.com/v4/letter/n/c2a13f/32.png) [@nwrner](https://forum.inductiveautomation.com/u/nwrner)\
**Post date:** [April 19, 2017, 4:51pm UTC](https://forum.inductiveautomation.com/t/help-printing-name-of-tag/14084/3 "2017-04-19T16:51:54Z")

</div>

Thank you so much for your help!  
Made my day a lot easier.

Thanks again!
