Does anyone have a solution for the weird Azure Po...
# prefect-server
p
Does anyone have a solution for the weird Azure Postgres username format (
user@host
) when used in a connection string? If I replace it by
%40
I have the
graphql
service complaining about an invalid interpolation - If I leave it in the bit after the @ is parsed as the host (including the password etc) by
hasura
… Is there any other format I can pass to
--postgres-url
?
PS: This is the issue I also tried by setting the variables independently in the
config.toml
but that leads to the same result
Or in simpler words: how do I escape an
@
from the username in the connection string passed to
--postgres-url
?
I am confused because in her

video

Laura mentions she is able to do it on Azure, even though in her case it’s with the helm chart rather than the docker-compose approach
k
Looked at Laura’s video and she used the default database. Not really sure here but could you show the invalid interpolation error?
p
Just realized I didn’t expose the issue very clearly: • Azure Postgresql automatically sets the username to
user@host
• This leads to a weird connection string:
<postgres://user@host>:password@server:port/dbname
• Because of this, most client will struggle parsing it, thinking the part after the
@
in the username is the server (and that there is no password) • This is a know problem as the SO link above shows
When I pass it in that form to
--postgres-url
I get a `“internal”:“invalid port number:
"<password>@<host>.<http://postgres.database.azure.com:5432\|postgres.database.azure.com:5432\>"
>> it basically thinks the part after the
@
in the username is the server address
If I replace the
@
in the username as
%40
(url encoded) it’s the
graphql
service that throws an error:
Error: invalid interpolation syntax in <my-postgres-url>
It’s obviously very stupid that Azure sets the user in this format, but I can’t figure a workaround…
And just to be precise: I believe this happens when trying to run the Alembic migrations. It seems to be this exact error.
k
Hey sorry I think a look at this but really can’t think of anything to advice
p
k
Sounds good
j
@Pierre Monico maybe you’ve solved it but I had this issue in the past. Solved it with the snippet above!
k
Oh nice. Could you chime in here also Julio?
j
Sure!