Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion airflow/providers/microsoft/mssql/hooks/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"""Microsoft SQLServer hook module"""
from __future__ import annotations

from typing import Any
from typing import Any, Dict

import pymssql

Expand Down Expand Up @@ -51,6 +51,15 @@ def __init__(
self.schema = kwargs.pop("schema", None)
self._sqlalchemy_scheme = sqlalchemy_scheme

@staticmethod
def get_ui_field_behaviour() -> Dict[str, Any]:
"""Returns custom UI field behaviour for MSSQL Connection."""
return {
"relabeling": {
"schema": "Database",
},
Comment on lines +58 to +60
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets add this to base DB api hook instead -- it'll right for all the subclasses much more than calling it schema currently is!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inheritance doesn't work for these methods though unfortunately.

aside... one thing that's unfortunate about relabeling is it doesn't help much when defining creds in env vars. for that case it's a bit nicer to have them named properly as extras... though not much to do about that now i guess.

}

@property
def connection_extra_lower(self) -> dict:
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Configuring the Connection
Host (required)
The host to connect to.

Schema (optional)
Specify the schema name to be used in the database.
Database (optional)
Specify the database name to be used

Login (required)
Specify the user name to connect.
Expand Down