You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/19 15:35:19 UTC
[GitHub] [airflow] dstandish commented on pull request #6850: [AIRFLOW-6296] add ODBC hook & deprecation warning for pymssql
dstandish commented on pull request #6850:
URL: https://github.com/apache/airflow/pull/6850#issuecomment-676500165
> Is it possible to use turbodbc with this as well, or would that have to be a separate custom hook?
Support could be added easily because the odbc conn str can be reused.
Internally what I did was add this method so you can choose turbodbc client optionally:
```python
def get_turbodbc_connection(self, turbodbc_options: Optional[dict] = None):
# imported locally so turbodbc can be optional
import turbodbc
from turbodbc import make_options
from turbodbc_intern import Megabytes
default_options_kwargs = dict(
read_buffer_size=Megabytes(300),
large_decimals_as_64_bit_types=True,
prefer_unicode=True,
autocommit=True,
)
turbodbc_options = make_options(**{**default_options_kwargs, **(turbodbc_options or {})})
return turbodbc.connect(connection_string=self.conn_str, turbodbc_options=turbodbc_options)
```
----------------------------------------------------------------
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:
users@infra.apache.org