# Proper system.db.runNamedQuery usage in python

**URL:** <https://forum.inductiveautomation.com/t/proper-system-db-runnamedquery-usage-in-python/29768>\
**Category:** Ignition\
**Created:** [November 7, 2019, 8:26pm UTC](https://forum.inductiveautomation.com/t/proper-system-db-runnamedquery-usage-in-python/29768 "2019-11-07T20:26:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [November 7, 2019, 8:50pm UTC](https://forum.inductiveautomation.com/t/proper-system-db-runnamedquery-usage-in-python/29768/2 "2019-11-07T20:50:08Z")

</div>

```auto
# Not a great example, but (something very much like) this works for me
roles = system.dataset.toPyDataSet(system.db.runNamedQuery(“UserManagement/Get Roles for a UserName”, {‘UserName’:row.get(‘username’)}))
entries = []
for i in range (len(roles)):
    entries.append(roles[i][0])
return ', '.join(map(str, entries))

```

You should note that in my example I’m using 8.0.6, so runNamedQuery no longer requires a project name argument. I have no idea how you’re acquiring the `row` variable you’re using to get the user’s name, and so I didn’t use arguments in my query. My result came back as  
`"Supervisor, OtherRole, Third"`.

If this isn’t helpful, could you provide any stacktrace you’ve come across when your Designer crashes?

---

_[View the full topic](https://forum.inductiveautomation.com/t/proper-system-db-runnamedquery-usage-in-python/29768)._
