From 93a4deb7f8fe2fbf9c7c9818da5e1fe78addc397 Mon Sep 17 00:00:00 2001 From: matt-heery Date: Fri, 7 Jun 2024 15:07:27 +0100 Subject: [PATCH 1/2] adding working test for sqlserver --- tests/test_sqlalchemy_converter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test_sqlalchemy_converter.py b/tests/test_sqlalchemy_converter.py index 9a93405..628ab11 100644 --- a/tests/test_sqlalchemy_converter.py +++ b/tests/test_sqlalchemy_converter.py @@ -36,6 +36,7 @@ # The following dialects are skipped by default, tested if value is set to 'True' test_oracle = os.getenv("TEST_ORACLE", "False") == "True" test_postgres = os.getenv("TEST_POSTGRES", "False") == "True" +test_sqlserver = os.getenv("TEST_SQLSERVER", "False") == "True" # Create engines @@ -57,6 +58,10 @@ def create_sqlachemy_engine(dialect): engine = create_engine( f"postgresql://postgres:{password}@localhost:5432/postgres" ) + elif dialect == "sqlserver": + engine = create_engine( + f"mssql+pyodbc://{user}:{password}@127.0.0.1:1433/test_mojap_metadata?driver=ODBC+Driver+17+for+SQL+Server" + ) return engine @@ -195,6 +200,19 @@ def expected_metadata( "int32", marks=(pytest.mark.skipif(test_oracle is False, reason="skip oracle test")), ), + pytest.param( + "sqlserver", + "dbo", + "this is my table", + "this is the comment", + ["my_string_10"], + "bool", + marks=( + pytest.mark.skipif( + test_sqlserver is False, reason="skip sqlserver test" + ) + ), + ), ], ) def test_generate_to_meta( From 49cb3f03ec4dd88b82a4ab666c50a580f29ed73e Mon Sep 17 00:00:00 2001 From: matt-heery Date: Fri, 7 Jun 2024 15:20:19 +0100 Subject: [PATCH 2/2] removing too long line --- tests/test_sqlalchemy_converter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_sqlalchemy_converter.py b/tests/test_sqlalchemy_converter.py index 628ab11..765f10e 100644 --- a/tests/test_sqlalchemy_converter.py +++ b/tests/test_sqlalchemy_converter.py @@ -60,7 +60,8 @@ def create_sqlachemy_engine(dialect): ) elif dialect == "sqlserver": engine = create_engine( - f"mssql+pyodbc://{user}:{password}@127.0.0.1:1433/test_mojap_metadata?driver=ODBC+Driver+17+for+SQL+Server" + f"mssql+pyodbc://{user}:{password}@127.0.0.1:1433/ \ + test_mojap_metadata?driver=ODBC+Driver+17+for+SQL+Server" ) return engine