Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New custom report options are causing an error loading the budget. #39

Closed
2 tasks done
cgiacofei opened this issue Jul 12, 2024 · 3 comments · Fixed by #42
Closed
2 tasks done

New custom report options are causing an error loading the budget. #39

cgiacofei opened this issue Jul 12, 2024 · 3 comments · Fixed by #42
Labels
bug Something isn't working

Comments

@cgiacofei
Copy link

Checks

  • I have checked that this issue has not already been reported.
  • I have confirmed this bug exists on the latest version of actualpy.

Reproducible example

from actual import Actual
from datetime import datetime

with Actual(
    base_url="https://<URL>",
    password="<Password>",
    encryption_password="<Encrypt Password>",
    file="<Budget Name>",
    data_dir="."
) as actual:
    current_date = datetime.now().strftime("%Y%m%d-%H%M")
    actual.export_data(f"actual_backup_{current_date}.zip")

Log output

Traceback (most recent call last):
  File "D:\Shared\Projects\BudgetFiles\test.py", line 4, in <module>
    with Actual(
  File "D:\Shared\Projects\BudgetFiles\venv\Lib\site-packages\actual\__init__.py", line 91, in __enter__
    self.download_budget(self._encryption_password)
  File "D:\Shared\Projects\BudgetFiles\venv\Lib\site-packages\actual\__init__.py", line 322, in download_budget
    self.sync()
  File "D:\Shared\Projects\BudgetFiles\venv\Lib\site-packages\actual\__init__.py", line 352, in sync
    self.apply_changes(changes.get_messages(self._master_key))
  File "D:\Shared\Projects\BudgetFiles\venv\Lib\site-packages\actual\__init__.py", line 272, in apply_changes
    raise ActualError(
actual.exceptions.ActualError: Actual found a column not supported by the library: column 'include_current' at table 'custom_reports' not found

Issue description

Attempting to perform budget backup using the example given in repo as a test. An object of class Actual is not able to be created due to the repo schema not including the new include_current field in custom reports.

Expected behavior

The budget should load.

Installed versions

  • actualpy version: 0.1.1
  • Actual Server version: v24.7.0
@cgiacofei cgiacofei added the bug Something isn't working label Jul 12, 2024
@cgiacofei cgiacofei changed the title New custom report options are causing an error. New custom report options are causing an error loading the budget. Jul 12, 2024
@cgiacofei
Copy link
Author

Adding the column to the CustomReports schema in database.py seems to be all that's needed to fix the error.

class CustomReports(BaseModel, table=True):
    __tablename__ = "custom_reports"

    ...
    include_current: Optional[int] = Field(default=None, sa_column=Column("include_current", Integer))

@bvanelli
Copy link
Owner

Hello @cgiacofei , thanks for your report, I think I missed this columns because my local docker version was still running an older version of Actual. I added a patch at #42

I added a test to prevent the model from not being updated in the future, and it complains on the latest version that the column was missing:

image

@bvanelli
Copy link
Owner

I merged #42 and you can now install from git.

I would like to do some further testing before generating a new version, feel free to reopen the issue if you still have issues after installing the newest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants