MsSQLHook and pymssql Adaptive Server connection failed #42691
-
Apache Airflow version2.10.2 If "Other Airflow 2 version" selected, which one?No response What happened?Connecting to mssql server caused an adaptive server issue and database could not be accessed.
What you think should happen instead?Connection hook should be successful if the Airflow connection variable is readable and filled in correctly. Logs below:
How to reproduceapache-airflow-providers-microsoft-mssql-3.9.1 Use MsSQL hook to connect to database using a MSSQL connection from the Airflow connection menu. Operating SystemCentOS 7 Versions of Apache Airflow Providersapache-airflow-providers-microsoft-mssql-3.9.1 DeploymentVirtualenv installation Deployment detailsNo response Anything else?Problem occurs using apache-airflow-providers-microsoft-mssql-3.9.1 and pymssql-2.3.1 and apache-airflow-providers-common-sql-1.17.1 Reverting back to apache-airflow-providers-microsoft-mssql-3.4.2, pymssql-2.2.4 and apache-airflow-providers-common-sql-1.7.2 fixed my issue. See similar issue here: pymssql/pymssql#913 Are you willing to submit PR?
Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 13 replies
-
@anthony-joyce - As in pymssql/pymssql#913 , are you using an environment variable similar to this? export AIRFLOW_CONN_MSSQL_DEFAULT='mssql+pymssql://usr:[email protected]/dbname' |
Beta Was this translation helpful? Give feedback.
-
@gordthompson Hi Gord. Thanks for the reply. I am not, currently. I was using the connection variable from the Airflow environment (Airflow menu --> Connections). Unless that connection is getting rendered incorrectly before being passed to mssql..... Should I be using an environment variable similar to what you have posted? Thanks! |
Beta Was this translation helpful? Give feedback.
-
I have zero experience with Airflow so I don't know the best approach to use in your case. I was really asking if you were using a connection URL of that form. If you were, then I would suggest trying
to see if that helps. Can you add the extra |
Beta Was this translation helpful? Give feedback.
-
Added {tds_version: 7.0} to the connection but still receiving errors. Connection URI looks like: Hopefully others will chime in as the is getting triaged. Thanks again @gordthompson. |
Beta Was this translation helpful? Give feedback.
-
This is at most a discussion at this stage, not "airflow issue". Hopefully someone will help you - but without having details of the issue and you looking at and digging out server logs explaining what was the root cause of the issue. There are lots of similar issues if you google for it - for example including wrong or bad passwords or too long ones etc., and the error you see might be indication of any pof those - and I believe the only way to know the reason is to actually look at server logs - because for security reasons the reason why your authentication failed is never explained to the client, so you are the only person in the world who can look at your server logs and see why connection attempt was rejected. Most likely however you have some problem with URL-encoding of your URL (See more details about it in the documentation of Airflow https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html - where URI format and some tools to generate the right URI are described and explained. But this is a wild guess and you need to experiment and look in your logs and attempt to figure it out on your own. |
Beta Was this translation helpful? Give feedback.
Just in case you haven't heard: Setting the TDSDUMP environment variable before running your test script, e.g.,
export TDSDUMP=/tmp/tdsdump.txt
logs all of the gory details to the specified file. For example, if I try connecting to SQL Server 2008 without
tds_version=7.0
I seewhereas with
tds_version=7.0
I see