Repository navigation
Replies: 1 comment
|
conn = await asyncpg.connect(
host=host, port=port, user=user, password=jwt_token, database=db,
server_settings={'options': '--crdb:jwt_auth_enabled=true'},
)With SQLAlchemy: engine = create_async_engine(
url,
connect_args={'server_settings': {'options': '--crdb:jwt_auth_enabled=true'}},
)Keeping it in a plain asyncpg DSN ( I checked this with a small fake server that captures the startup message on asyncpg 0.32.0. Both forms sent |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi, I use cockroachdb, with a connection authenticated by JWT token. My SQLAlchemy/psycopg2 connection string ends in
?options=--crdb:jwt_auth_enabled=true, which works brilliantly, but I'm having trouble translating that intoasyncpg-speak. I think in general the FAQ could answer a few questions about how to translate connection string options over from psycopg2.The main thing I've tried so far is to set different variants of
--crdb:jwt_auth_enabledandjwt_auth_enabledtotrueinconnect_args[“server_settings”], but I'm still failing to connect via asyncpg. Presumably this flag needs to be passed a different way.I have more background over at the CockroachDB forum: https://forum.cockroachlabs.com/t/sqlalchemy-asyncpg-and-jwt/7009
Please let me know if there's something else I should try.
All reactions