-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add get_identifier to hive source in metadata ingestion
The hive source currently does not include the catalog name in the schema name. This is due to the SQLAlchemy reflection that pyhive performs. Without the catalog name, multiple hive sources could have collisions with the urns generated. This function will add the database name where applicable and solve this problem.
- Loading branch information
Showing
3 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import unittest | ||
|
||
from datahub.ingestion.source.hive import HiveConfig | ||
|
||
|
||
class HiveSinkTest(unittest.TestCase): | ||
def test_hive_configuration_get_indentifier_with_database(self): | ||
test_db_name = "test_database" | ||
test_schema_name = "test_schema" | ||
test_table_name = "test_table" | ||
config_dict = { | ||
"username": "test", | ||
"password": "test", | ||
"host_port": "test:80", | ||
"database": test_db_name, | ||
"scheme": "hive+https", | ||
} | ||
hive_config = HiveConfig.parse_obj(config_dict) | ||
expected_output = f"{test_db_name}.{test_schema_name}.{test_table_name}" | ||
output = hive_config.get_identifier( | ||
schema=test_schema_name, table=test_table_name | ||
) | ||
assert output == expected_output |