Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making mssql provider to support only mssql+pymssql dialect #39586

Closed
2 tasks done
rawwar opened this issue May 13, 2024 · 8 comments
Closed
2 tasks done

Making mssql provider to support only mssql+pymssql dialect #39586

rawwar opened this issue May 13, 2024 · 8 comments

Comments

@rawwar
Copy link
Collaborator

rawwar commented May 13, 2024

Description

Currently, we allow users to pass dialect via sqlalchemy_scheme extra field of the mssql connections.

def sqlalchemy_scheme(self) -> str:

I am proposing to remove this field as it is not possible to support multiple dialects without installing the relevant dialect driver. Also, the documentation page does not even mention about sqlalchemy_scheme or the possibility of using other dialects.

Use case/motivation

Supporting multiple dialects requires the installation of multiple drivers. Since we only install pymssql, this allows the usage of the mssql+pymssql dialect alone and not others.

I am also interested in updating the documentation to reflect this.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@rawwar rawwar added kind:feature Feature Requests needs-triage label for new issues that we didn't triage yet provider:microsoft-mssql labels May 13, 2024
@rawwar
Copy link
Collaborator Author

rawwar commented May 14, 2024

@Taragolis , requesting your comments on this.

I was working on updating mssql provider to use sqlalchemy_url property in get_uri and got the idea for this issue.

@eladkal
Copy link
Contributor

eladkal commented Jun 9, 2024

It looks like a small code change? If so it's better to simply raise PR we can have the discussion on the PR itself

@shahar1 shahar1 added area:providers and removed needs-triage label for new issues that we didn't triage yet labels Jul 13, 2024
@shahar1
Copy link
Contributor

shahar1 commented Jul 13, 2024

@rawwar Would you still like to work on this issue?

@dabla
Copy link
Contributor

dabla commented Jul 18, 2024

@Taragolis , requesting your comments on this.

I was working on updating mssql provider to use sqlalchemy_url property in get_uri and got the idea for this issue.

I've already fixed this issue in PR 40669. I've tested it with JdbcHook and OdbcHook on multiple databases and also with MsSqlHook and all works fine. You can also define the 'sqlalchemy_scheme' parameter in the extra field of the Connection when using JdbcHook so SQLAlchemy get's the correct dialect instead of the 'jdbc' protocol value.

@dabla
Copy link
Contributor

dabla commented Jul 18, 2024

An overview of all enhancements and fixes I did regarding hooks:

40665
40669
40751
40836

We already patched our Airflow production env with those changes and all works great.

@shahar1
Copy link
Contributor

shahar1 commented Jul 18, 2024

Thanks @dabla , I'll assign this issue on you then.

@dabla
Copy link
Contributor

dabla commented Jul 19, 2024

Description

Currently, we allow users to pass dialect via sqlalchemy_scheme extra field of the mssql connections.

def sqlalchemy_scheme(self) -> str:

I am proposing to remove this field as it is not possible to support multiple dialects without installing the relevant dialect driver. Also, the documentation page does not even mention about sqlalchemy_scheme or the possibility of using other dialects.

Use case/motivation

Supporting multiple dialects requires the installation of multiple drivers. Since we only install pymssql, this allows the usage of the mssql+pymssql dialect alone and not others.

I am also interested in updating the documentation to reflect this.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

We could "remove" that property in MsSqlHook, but we for example are actually using is as we have installed multiple drivers (pymssql/odbc/jdbc/...) to access multiple databases. Indeed the 'sqlalchemy_scheme' schould be documented, especially in the case of the JdbcHook are there it is required to define it if you want to use the sqlalchemy engine. Maybe we should generalize that property and move it to the DbApiHook, as this code is duplicated in MsSqlHook and OdbcHook.

@dabla
Copy link
Contributor

dabla commented Aug 6, 2024

As PR40669 has been closed I think this one can also be closed?

@potiuk potiuk closed this as completed Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants