sfc-gh-twhite commented on issue #1047:
URL: https://github.com/apache/arrow-adbc/issues/1047#issuecomment-1713970119

   That would make sense! I still seem to need help to run into trouble. I can 
get connected using a pure URI, but when I specify the arguments in various 
ways optionally, it doesn't establish the various contexts. 
   
   I rewrote the first part of my code to organize things a bit more for 
testing purposes:
   ```
   import os
   import adbc_driver_snowflake.dbapi
   from dotenv import load_dotenv
   
   load_dotenv(override=True)
   
   connection_params = {
       "_".join(k.split("_")[1:]).lower(): v
       for k, v in os.environ.items()
       if k.upper().startswith("SNOWFLAKE")
   }
   
   
   def format_uri(connection_params) -> str:
       user = connection_params.get('user')
       password = connection_params.get('password')
       account = connection_params.get('account')
       return f"{user}:{password}@{account}"
   ```
   
   Now I am trying both (swapping db and database)
   ```
   conn = adbc_driver_snowflake.dbapi.connect(
       uri=format_uri(connection_params),
       db_kwargs={
           "db": "TWHITE",
           "schema": "COMMON",
           "role": "SYSADMIN"
       },
   )
   
   cur = conn.cursor()
   cur.execute(operation="SELECT CURRENT_DATABASE();")
   cur.fetchall()
   ```
   
   and
   
   ```
   conn = adbc_driver_snowflake.dbapi.connect(
       uri=format_uri(connection_params),
       db_kwargs={
           "database": "TWHITE",
           "schema": "COMMON",
           "role": "SYSADMIN"
       },
   )
   
   cur = conn.cursor()
   cur.execute(operation="SELECT CURRENT_DATABASE();")
   cur.fetchall()
   ```
   
   and it keeps resulting in `[(None,)]`. 
   
   I can get by just using the URI, but this will take me a little while to get 
used to. :) 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to