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
importasyncpgcon=awaitasyncpg.connect('postgresql://tenants@localhost:5433/internal?application_name=app_name')
r=awaitcon.fetchrow("SELECT current_setting('application_name')")
Out[1]: <Recordcurrent_setting='app_name'>con=awaitasyncpg.connect('postgresql://postgres@localhost:5433/internal?options=-c%20app.name%3Dapp_name')
r=awaitcon.fetchrow("SELECT current_setting('app.name')")
rOut[2]: <Recordcurrent_setting='app_name'>but doing it with gino as shown below doesn't work.
fromginoimportGinodb=Gino()
awaitdb.set_bind('postgresql://tenants@localhost:5433/internal?application_name=app_name')
r=awaitdb.all("SELECT current_setting('application_name')")
print(r)
Out[3]: [('',)]
db=Gino()
awaitdb.set_bind('postgresql://postgres@localhost:5433/internal?options=-c%20app.name%3Dapp_name')
r=awaitdb.all("SELECT current_setting('app.name')")
print(r)
Out[4]: asyncpg.exceptions.UndefinedObjectError: unrecognizedconfigurationparameter"app.name"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?
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?