You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Get your db instance yada# Set valueawaitdb.one_or_none("select context('application_name', 'my awesome gino application');")
# Get valueawaitdb.one_or_none("select context('application_name');")
Can't test this code ATM, but maybe context vars are the way to go for psql.
Thank you for your response, I am not sure how to do this as a wrapper.
the reason I wanted to pass the parameter in the url so that I don't need to change any of my existing queries.
If you have any idea i would appreciate discussing it and trying it out.
@mpdevilleres I understand the intention to not alter existing queries.
I'm gonna assume you're either using gino with an adapter, such as gino-quart, or directly, which should allow you to manipulate the individual connection.
I'm not sure if you're able to get away without changing queries completely. You might either need to prepend a statement to you queries (no idea how but you could try to play with SQLalchemy) or set a session related variable. I have found on related question on SO.
I would love to further discuss on this but I'm currently busy with studying and my responses might take some time. I hope the above mentioned articles will be helpful. You might also want to open question in asyncpg's repo about this, since it's used under the hood.
Greetings,
I have a use case where I need to set the variable for each session or connection.
and I am able to accomplish it using the asyncpg directly
but doing it with gino as shown below doesn't work.
I also tried passing
connect_args={"application_name":"myapp"}
as recommended by zzzeek on set_bind. but I still fail to make it work.Is there anyway for gino to achieve my use case?
The text was updated successfully, but these errors were encountered: