-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Alembic raising an error when creating the migration script for a postgreSQL DB #3
Comments
@afcristia The "%" that you have in your password is causing this, because this character is used for interpolation. Use "%%" to escape it. |
thanks for your prompt reply. However, I'am affraid that's not it, as my password doesn't have a % sign. I'm attaching my .env file (with a .txt extension) so you can check. Alembic is changing ".," in my password for ".%2C" somewhere with its code, but I have no idea where it could be. |
To determine where is this happening it would be useful to see the complete stack trace of the error. |
I'm now attaching the whole output. Thanks again for your support. |
In env.py, change this line: config.set_main_option("sqlalchemy.url", engine.url.render_as_string(
hide_password=False)) to this: config.set_main_option("sqlalchemy.url", engine.url.render_as_string(
hide_password=False).replace('%', '%%')) Let me know if that helps! |
I am working through the book (Kindle version) and got stuck when introducing Alembic as the create migration command raises an error as follows:
File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/configparser.py", line 374, in before_set
raise ValueError("invalid interpolation syntax in %r at "
ValueError: invalid interpolation syntax in 'postgresql+psycopg2://retrofun:123.%[email protected]:5432/retrofun' at position 35
I'm running a postgreSQL database on another computer on my local network. I tried copying the line used for SQLAlchemy to connect with no luck.
I know I could be missing something but I could find a suitable solution when googling for a solution, hence the need to reach out to you.
I am adding the env.py (as a .txt file as GitHub doesn't allow .py files)
env.txt
The text was updated successfully, but these errors were encountered: