# Badge Queries - data in csv or other db?

**URL:** https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158
**Category:** Support
**Created:** [05.Май.2017 10:45:56 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158 "2017-05-05T10:45:56Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Er00](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/er00/32/42921_2.png) [@Er00](https://meta.discourse.org/u/Er00)
#### Post date: [05.Май.2017 10:45:56 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/1 "2017-05-05T10:45:56Z")

</div>

Is it possible to run a badge query against data in another db or a csv? We’d like to give a badge to users who match certain criteria in our (ie non-Discourse) accounts database, but not just retroactively.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [05.Май.2017 11:12:37 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/2 "2017-05-05T11:12:37Z")

</div>

You will have to write a plugin for that.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [05.Май.2017 12:27:30 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/3 "2017-05-05T12:27:30Z")

</div>

Another solution would be to do that via the api.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [02.Июнь.2019 12:36:04 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/4 "2019-06-02T12:36:04Z")

</div>



---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [02.Июнь.2019 17:41:24 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/5 "2019-06-02T17:41:24Z")

</div>

The easiest way to grant a badge based on activity that occurs outside of Discourse would be to create a custom badge on Discourse through the UI, and then grant the badge through the Discourse API. See [Grant a custom badge through the API](https://meta.discourse.org/t/how-to-grant-a-custom-badge-through-the-api/103270) for details.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [02.Июнь.2019 17:41:27 UTC](https://meta.discourse.org/t/badge-queries-data-in-csv-or-other-db/62158/6 "2019-06-02T17:41:27Z")

</div>


