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

Add mssql integration tests and relocate existing unit tests #39831

Merged
merged 2 commits into from
May 27, 2024
Merged
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
5 changes: 5 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ jobs:
breeze testing integration-tests --integration qdrant
breeze down
if: inputs.is-airflow-runner != 'true' && matrix.backend == 'postgres'
- name: "Integration Tests Postgres: mssql"
run: |
breeze testing integration-tests --integration mssql
breeze down
if: inputs.is-airflow-runner != 'true' && matrix.backend == 'postgres'
# For Self Hosted runners we run complete set of integration tests
# in one big test - as we have enough resources to start all integrations
# and we do that for both - postgres and mysql
Expand Down
9 changes: 5 additions & 4 deletions airflow/providers/microsoft/mssql/hooks/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from typing import TYPE_CHECKING, Any

import pymssql
from pymssql import Connection as PymssqlConnection

from airflow.providers.common.sql.hooks.sql import DbApiHook

Expand Down Expand Up @@ -104,23 +105,23 @@ def get_sqlalchemy_connection(
engine = self.get_sqlalchemy_engine(engine_kwargs=engine_kwargs)
return engine.connect(**(connect_kwargs or {}))

def get_conn(self) -> pymssql.connect:
def get_conn(self) -> PymssqlConnection:
"""Return ``pymssql`` connection object."""
conn = self.connection
return pymssql.connect(
server=conn.host,
user=conn.login,
password=conn.password,
database=self.schema or conn.schema,
port=conn.port,
port=str(conn.port),
)

def set_autocommit(
self,
conn: pymssql.connect,
conn: PymssqlConnection,
autocommit: bool,
) -> None:
conn.autocommit(autocommit)

def get_autocommit(self, conn: pymssql.connect):
def get_autocommit(self, conn: PymssqlConnection):
return conn.autocommit_state
2 changes: 2 additions & 0 deletions contributing-docs/testing/integration_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ The following integrations are available:
+--------------+----------------------------------------------------+
| mongo | Integration required for MongoDB hooks. |
+--------------+----------------------------------------------------+
| mssql | Integration required for mssql hooks. |
+--------------+----------------------------------------------------+
| openlineage | Integration required for Openlineage hooks. |
+--------------+----------------------------------------------------+
| otel | Integration required for OTEL/opentelemetry hooks. |
Expand Down
4 changes: 2 additions & 2 deletions dev/breeze/doc/images/output-commands.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading