python-telegram-bot / python-telegram-bot/ptbcontrib

[BUG] PostgresPersistence does not correcly load data from database.

Open
#108 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug :bug:
Dominant language
Python
Stars
118
Forks
47
PR merge metrics
No merged PRs in 30d

Description

Module this issue is about

ptbcontrib/postgres_persistence/postgrespersistence.py

Steps to reproduce
  1. Use specified module as persistence class.

  2. Build your application loading the persistence.

  3. Add some random data inside bot_data, as it is the only one usable before getting updates.

  4. Generate an update so the persistence is updated in the database.

  5. Restart the bot script.

Expected behaviour

Added data (step 3) should be correctly loaded from database, so *_data dictionaries should contain the same information they had before restarting bot script.

Actual behaviour

Even if database is actually updated, *_dict are empty, so persistence is not restored correctly.

Configuration

Operating System:
Distributor ID: Linuxmint
Release: 21.3

Version of Python, python-telegram-bot & dependencies:
Python 3.12
PTB 21.2

Please Note

This is the first time I'm trying to contribute, so sorry if something is not clear enough.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ptbcontrib/postgres_persistence/postgrespersistence.py and reproduce the reported sequence: add data to bot_data, generate an update, then restart the bot. Trace the database loading path and verify that the *_data dictionaries contain the same values after restart; done means persistence data is restored instead of remaining empty.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.