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

Remove the memory option for database URL #213

Closed
pmeier opened this issue Nov 19, 2023 · 1 comment · Fixed by #320
Closed

Remove the memory option for database URL #213

pmeier opened this issue Nov 19, 2023 · 1 comment · Fixed by #320
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Milestone

Comments

@pmeier
Copy link
Member

pmeier commented Nov 19, 2023

After #205, the config is no longer in use for the Python API. Thus, we can just use a local sqlite instance as default to have persistence. Users can still select an ephemeral in-memory database by using sqlite:// as option.

Here are some places where changes need to happen

  • Config wizard
    if questionary.confirm(
    "Do you want to use a SQL database to persist the chats between runs?",
    default=True,
    qmark=QMARK,
    ).unsafe_ask():
    config.api.database_url = questionary.text(
    "What is the URL of the database?",
    default=f"sqlite:///{config.local_cache_root / 'ragna.db'}",
    qmark=QMARK,
    ).unsafe_ask()
    else:
    config.api.database_url = "memory"
  • REST API
    database_url = config.api.database_url
    if database_url == "memory":
    database_url = "sqlite://"
    make_session = database.get_sessionmaker(database_url)
  • REST API tests
    @pytest.mark.parametrize("database", ["memory", "sqlite"])
    def test_e2e(tmp_local_root, database):
    if database == "memory":
    database_url = "memory"
@pmeier pmeier added help wanted Extra attention is needed good first issue Good for newcomers labels Nov 19, 2023
@pmeier
Copy link
Member Author

pmeier commented Nov 19, 2023

@nenb I think you requested this somewhere, but I can't find it. If this is still in open issue, please x-ref this here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant