langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Fix DB migration erro with Azure PostgreSQL Password with Langflow v0.6.14

Open Alperemrehas opened this issue 10 months ago • 1 comments

Description

This pull request addresses an issue encountered when connecting a PostgreSQL database on Azure, where Azure requires an "@" symbol in all database usernames. Previously, changing passwords containing "@" was a workaround, but it's no longer feasible. Consequently, the migration process failed. To resolve this, a fix has been applied to handle passwords containing "@" by replacing "@" with "%40" in the code.

However, during the initialization of Alembic migrations, a single "%" symbol caused failure. This pull request resolves this issue by replacing single "%" with "%%".

Changes Made

  • Modified the DatabaseService class in service.py to handle passwords containing "@" by replacing "@" with "%40" in the database URL.
  • Adjusted the alembic_cfg.set_main_option("sqlalchemy.url", self.database_url.replace('%', '%%')) line to replace single "%" with "%%" to prevent initialization failure during Alembic migrations.

Related Issues

Error in DB migration with PostgreSQL for Langflow v0.6 #1432

Checklist

  • Tested the changes locally

Alperemrehas avatar Apr 16 '24 20:04 Alperemrehas

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langflow ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 16, 2024 8:20pm

vercel[bot] avatar Apr 16 '24 20:04 vercel[bot]

Thanks for the PR, @Alperemrehas

One quick note: v0.6.14 is the main branch. This is the dev branch. We should fix this in the dev too but I'm just not sure if this is what you intended to do.

LGTM, so I'm merging it to start utilizing the fix in the 1.0 alpha.

Thank you Gabriel,

Actually, my bad I did missed that it should be with the dev. So if it is not needed to replicate that for dev, I could work on dev later on. If it is needed I can fork and create a PR for dev either.

Alperemrehas avatar Apr 18 '24 15:04 Alperemrehas