dstandish edited a comment on issue #6850: [AIRFLOW-6296] add mssql odbc hook
URL: https://github.com/apache/airflow/pull/6850#issuecomment-570388793
 
 
   @baolsen 
   > I really feel that SQL Alchemy might be useful here. Using different 
dialects allows us to be backwards compatible and let the user decide whether 
to use pymssql or pyodbc (with the extra effort that it requires).
   
   it's an interesting idea but i think it actually increases complexity to go 
that way.  then your hook logic, and the design of your connection object 
parsing, has to be able to handle arbitrary mssql libraries. 
   e.g. with pyodbc we can supply arbitrary odbc connection properties as 
key-value in conn.extra.  what would you do with these in pymssql?    you could 
do it, but i think it is cleaner and safer to keep things separate.
   and where in the conn object would you put the dialect selector?
   you'd still have to have a extra option for odbc support at install to 
enable pyodbc.
   and it while this could potentially be used for switching between pyodbc and 
pymssql, it could not be used for turbodbc or bcp.
   
   and i think that might be why conventionally in airflow it's the other way 
around -- hooks are defined in accordance with the idiosyncrasies of their 
connectors, and they can optionally generate a sqlalchemy connection.  and this 
PR does provide support for that here: 
(https://github.com/apache/airflow/blob/1b3b907ed6e8a45affa269b624dfe420d74424ed/airflow/providers/mssql/hooks/mssql_odbc.py#L156)
   (the `get_uri` method is used by dbapi hook to produce sqlalchemy engine; i 
also provide a get_sqlalchemy connection method)
   
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to