# FR: Access to DB from v3 scheduler custom JS

**URL:** <https://forums.ankiweb.net/t/fr-access-to-db-from-v3-scheduler-custom-js/12711>\
**Category:** Suggestions\
**Created:** [August 28, 2021, 1:49am UTC](https://forums.ankiweb.net/t/fr-access-to-db-from-v3-scheduler-custom-js/12711 "2021-08-28T01:49:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![closedabelian](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@closedabelian](https://forums.ankiweb.net/u/closedabelian)\
**Post date:** [August 28, 2021, 1:49am UTC](https://forums.ankiweb.net/t/fr-access-to-db-from-v3-scheduler-custom-js/12711/1 "2021-08-28T01:49:38Z")

</div>

Will it be possible to access the DB to perform queries from the JS? This will be useful for custom scheduling algorithms that take into account a card’s review history, current deck settings, etc.

I posted a proposal for [a new default Anki algorithm](https://forums.ankiweb.net/t/a-new-algorithm-for-anki/10150) (also cross-posted on Reddit where it generated a lot of upvotes) a while ago. If the v3 JS code can access the DB and deck settings, then there’s no need to bake this into Anki at all.

I’m a developer myself and would be happy to contribute to adding this feature to the v3 scheduler. Please let me know.

Thank you: )

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [August 29, 2021, 3:17am UTC](https://forums.ankiweb.net/t/fr-access-to-db-from-v3-scheduler-custom-js/12711/2 "2021-08-29T03:17:23Z")

</div>

Direct DB access is unlikely, but access to the review history may come in a future update.

---

<div class="post-metadata">

**Author:** ![closedabelian](https://avatars.discourse-cdn.com/v4/letter/c/b5e925/32.png) [@closedabelian](https://forums.ankiweb.net/u/closedabelian)\
**Post date:** [August 30, 2021, 1:11am UTC](https://forums.ankiweb.net/t/fr-access-to-db-from-v3-scheduler-custom-js/12711/3 "2021-08-30T01:11:35Z")

</div>

That’s great to hear! Being able to access a card’s:

- Historical ease, i.e. `select ease from revlog where cid = ?`
- Historical ease factors, i.e. `"select factor from revlog where cid = ? and factor > 0`
- Card’s deck settings or at least the default starting ease of a card), i.e. `mw.col.decks.confForDid( deck_id)['new']['initialFactor']`

would be critical for me to reimplement my proposed algorithm with the new scheduler.

Again, happy to contribute to the work, please keep me posted if you need any help 😃
