Skip to content

Commit

Permalink
Added Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Akash Verma authored and Akash Verma committed Jan 24, 2025
1 parent 7a4fd4b commit 73f3a4e
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 6 deletions.
16 changes: 10 additions & 6 deletions ingestion/src/metadata/examples/workflows/mssql.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
source:
type: mssql
serviceName: local_mssql
type: mssql-lineage
serviceName: local_mssql_2_2
serviceConnection:
config:
type: Mssql
database: catalog_test
database: master
username: sa
password: test!Password
hostPort: localhost:1433
password: yourStrong(!)Password
hostPort: ec2-3-142-98-17.us-east-2.compute.amazonaws.com:1433
sourceConfig:
config:
type: DatabaseMetadata
type: DatabaseLineage
queryLogDuration: 1
parsingTimeoutLimit: 300
# filterCondition: query_text not ilike '--- metabase query %'
resultLimit: 1000
sink:
type: metadata-rest
config: {}
Expand Down
37 changes: 37 additions & 0 deletions ingestion/tests/unit/test_snowflake_lowercase_name.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import pytest

from metadata.ingestion.source.database.snowflake.utils import format_full_schema_name


@pytest.mark.parametrize(
"full_schema_name, original_schema, current_database, expected_output",
[
(
'"UPPERCASE_DB".lowercase_schema',
"lowercase_schema",
"UPPERCASE_DB",
'"UPPERCASE_DB"."lowercase_schema"',
),
(
'lowercase_db."UPPERCASE_SCHEMA"',
"UPPERCASE_SCHEMA",
"lowercase_db",
'"lowercase_db"."UPPERCASE_SCHEMA"',
),
(
'"UPPERCASE_DB"."UPPERCASE_SCHEMA"',
"UPPERCASE_SCHEMA",
"UPPERCASE_DB",
'"UPPERCASE_DB"."UPPERCASE_SCHEMA"',
),
('"DOT.DB"."DOT.SCHEMA"', "DOT.SCHEMA", "DOT.DB", '"DOT.DB"."DOT.SCHEMA"'),
('"dbname.".schemaname', "schemaname", "dbname.", '"dbname."."schemaname"'),
],
)
def test_full_schema_name_sanitization(
full_schema_name, original_schema, current_database, expected_output
):
sanitized_schema = format_full_schema_name(
full_schema_name, original_schema, current_database
)
assert sanitized_schema == expected_output

0 comments on commit 73f3a4e

Please sign in to comment.