# programmatic way to get stats

**URL:** <https://support.prodi.gy/t/programmatic-way-to-get-stats/2730>\
**Category:** Uncategorized\
**Tags:** usage, database, solved\
**Created:** [March 30, 2020, 5:29pm UTC](https://support.prodi.gy/t/programmatic-way-to-get-stats/2730 "2020-03-30T17:29:40Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ines](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ines/32/3_2.png) [@ines](https://support.prodi.gy/u/ines)\
**Post date:** [March 30, 2020, 6:52pm UTC](https://support.prodi.gy/t/programmatic-way-to-get-stats/2730/2 "2020-03-30T18:52:11Z")

</div>

Yes, check out the `Database` API: [https://prodi.gy/docs/api-database#database](https://prodi.gy/docs/api-database#database) For example, here's how you would connect, get all dataset names and get all annotations of a given dataset:

```python
from prodigy.components.db import connect

db = connect()
all_dataset_names = db.datasets
examples = db.get_dataset("my_dataset")

```

The source of the `stats` command/recipe is also shipped with Prodigy, so you can always check it out in `recipes/commands.py` and see how it's done there.

---

_[View the full topic](https://support.prodi.gy/t/programmatic-way-to-get-stats/2730)._
