-
| What is the correct way to pass in parameters in a SET query? this will return  import asyncio
import asyncpg
async def main():
    conn = await asyncpg.connect(user="xx", password="yy", host="127.0.0.1", database="my_db")
    await conn.execute("select $1", "1")
    identity = "arn:aws:sts::123456:assumed-role/thing_1"
    await conn.execute("set session iam.identity = $1", identity)
asyncio.run(main()) | 
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            elprans
          
      
      
        Feb 4, 2022 
      
    
    Replies: 2 comments
-
| PostgreSQL does not support arguments in utility statements like  await conn.execute("select set_config('iam.identity', $1)", identity) | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
      Answer selected by
        cmflynn
-
| thanks! however, slight bug in your example. it should contain the arg  await conn.execute("select set_config('iam.identity', $1, false)", identity) | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
PostgreSQL does not support arguments in utility statements like
set. Use theset_configfunction instead: