Skip to content

Commit

Permalink
changing config name to something more meaningful
Browse files Browse the repository at this point in the history
  • Loading branch information
shirshanka committed Oct 19, 2022
1 parent 15694ef commit cc6932b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ class PrestoOnHiveConfig(BasicSQLAlchemyConfig):
description="Dataset Subtype name to be 'Table' or 'View' Valid options: ['True', 'False']",
)

add_db_name_to_urns: bool = Field(
include_catalog_name_in_ids: bool = Field(
default=False,
description="Add database name/alias to the generated dataset urns",
description="Add the Presto catalog name (e.g. hive) to the generated dataset urns. `urn:li:dataset:(urn:li:dataPlatform:hive,hive.user.logging_events,PROD)` versus `urn:li:dataset:(urn:li:dataPlatform:hive,user.logging_events,PROD)`",
)

def get_sql_alchemy_url(self, uri_opts: Optional[Dict[str, Any]] = None) -> str:
Expand Down Expand Up @@ -415,7 +415,7 @@ def loop_tables(
db_name = self.get_db_name(inspector)
schema_name = (
f"{db_name}.{key.schema}"
if self.config.add_db_name_to_urns
if self.config.include_catalog_name_in_ids
else key.schema
)

Expand Down Expand Up @@ -537,7 +537,7 @@ def get_hive_view_columns(self, inspector: Inspector) -> Iterable[ViewDataset]:
db_name = self.get_db_name(inspector)
schema_name = (
f"{db_name}.{key.schema}"
if self.config.add_db_name_to_urns
if self.config.include_catalog_name_in_ids
else key.schema
)
dataset_name = self.get_identifier(
Expand Down Expand Up @@ -575,7 +575,7 @@ def get_presto_view_columns(self, inspector: Inspector) -> Iterable[ViewDataset]
db_name = self.get_db_name(inspector)
schema_name = (
f"{db_name}.{row['schema']}"
if self.config.add_db_name_to_urns
if self.config.include_catalog_name_in_ids
else row["schema"]
)
dataset_name = self.get_identifier(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def loaded_presto_on_hive(presto_on_hive_runner):
@freeze_time(FROZEN_TIME)
@pytest.mark.integration_batch_1
@pytest.mark.parametrize(
"mode,use_catalog_subtype,use_dataset_pascalcase_subtype,add_db_name_to_urns,test_suffix",
"mode,use_catalog_subtype,use_dataset_pascalcase_subtype,include_catalog_name_in_ids,test_suffix",
[
("hive", False, False, False, "_1"),
("presto-on-hive", True, True, False, "_2"),
Expand All @@ -70,7 +70,7 @@ def test_presto_on_hive_ingest(
mode,
use_catalog_subtype,
use_dataset_pascalcase_subtype,
add_db_name_to_urns,
include_catalog_name_in_ids,
test_suffix,
):

Expand All @@ -94,7 +94,7 @@ def test_presto_on_hive_ingest(
"scheme": "postgresql+psycopg2",
"include_views": True,
"include_tables": True,
"add_db_name_to_urns": add_db_name_to_urns,
"include_catalog_name_in_ids": include_catalog_name_in_ids,
"schema_pattern": {"allow": ["^public"]},
"mode": mode,
"use_catalog_subtype": use_catalog_subtype,
Expand Down

0 comments on commit cc6932b

Please sign in to comment.