Some additional configuration/munging is needed to enable authentication to azure SQL services. We should add a section to the documentation explaining how this is done
import struct
from azure import identity
import sqlalchemy as sa
SQL_COPT_SS_ACCESS_TOKEN = 1256 # Connection option for access tokens, as defined in msodbcsql.h
TOKEN_URL = "https://database.windows.net/" # The token URL for any Azure SQL database
Please describe the issue
https://github.com/ibis-project/ibis/issues/7381#issuecomment-1766582531
Some additional configuration/munging is needed to enable authentication to azure SQL services. We should add a section to the documentation explaining how this is done
SQL_COPT_SS_ACCESS_TOKEN = 1256 # Connection option for access tokens, as defined in msodbcsql.h TOKEN_URL = "https://database.windows.net/" # The token URL for any Azure SQL database
azure_credentials = identity.DefaultAzureCredential()
def provide_token(dialect, conn_rec, cargs, cparams): """sqlalchemy.event.listens_for(ibis_conn.con, "do_connect")(provide_token) """
remove the "Trusted_Connection" parameter that SQLAlchemy adds
def make_ibis_connection_login_ad_interactive(conn): sa.event.listens_for(conn.con, "do_connect")(provide_token)
Code of Conduct