mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-15 20:16:52 +00:00
ingest(snowflake): remove email_as_user_identifier support (#13827)
This commit is contained in:
parent
b3a25d6fbd
commit
f8c6db07d8
@ -154,14 +154,11 @@ class SnowflakeIdentifierConfig(
|
||||
|
||||
email_domain: Optional[str] = pydantic.Field(
|
||||
default=None,
|
||||
description="Email domain of your organization so users can be displayed on UI appropriately.",
|
||||
description="Email domain of your organization so users can be displayed on UI appropriately. This is used only if we cannot infer email ID.",
|
||||
)
|
||||
|
||||
email_as_user_identifier: bool = Field(
|
||||
default=True,
|
||||
description="Format user urns as an email, if the snowflake user's email is set. If `email_domain` is "
|
||||
"provided, generates email addresses for snowflake users with unset emails, based on their "
|
||||
"username.",
|
||||
_email_as_user_identifier = pydantic_removed_field(
|
||||
"email_as_user_identifier",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -325,15 +325,10 @@ class SnowflakeIdentifierBuilder:
|
||||
user_email: Optional[str],
|
||||
) -> str:
|
||||
if user_email:
|
||||
return self.snowflake_identifier(
|
||||
user_email
|
||||
if self.identifier_config.email_as_user_identifier is True
|
||||
else user_email.split("@")[0]
|
||||
)
|
||||
return self.snowflake_identifier(user_email)
|
||||
return self.snowflake_identifier(
|
||||
f"{user_name}@{self.identifier_config.email_domain}"
|
||||
if self.identifier_config.email_as_user_identifier is True
|
||||
and self.identifier_config.email_domain is not None
|
||||
if self.identifier_config.email_domain is not None
|
||||
else user_name
|
||||
)
|
||||
|
||||
|
||||
@ -121,7 +121,6 @@ def test_snowflake_basic(pytestconfig, tmp_path, mock_time, mock_datahub_graph):
|
||||
format_sql_queries=True,
|
||||
validate_upstreams_against_patterns=False,
|
||||
include_operational_stats=True,
|
||||
email_as_user_identifier=True,
|
||||
incremental_lineage=False,
|
||||
start_time=datetime(2022, 6, 6, 0, 0, 0, 0).replace(
|
||||
tzinfo=timezone.utc
|
||||
|
||||
@ -36,7 +36,6 @@ def test_user_identifiers_email_as_identifier(snowflake_connect, tmp_path):
|
||||
"username": "TST_USR",
|
||||
"password": "TST_PWD",
|
||||
},
|
||||
"email_as_user_identifier": True,
|
||||
"email_domain": "example.com",
|
||||
},
|
||||
PipelineContext("run-id"),
|
||||
@ -63,7 +62,7 @@ def test_user_identifiers_email_as_identifier(snowflake_connect, tmp_path):
|
||||
|
||||
|
||||
@patch("snowflake.connector.connect")
|
||||
def test_user_identifiers_username_as_identifier(snowflake_connect, tmp_path):
|
||||
def test_user_identifiers_user_email_as_identifier(snowflake_connect, tmp_path):
|
||||
source = SnowflakeQueriesSource.create(
|
||||
{
|
||||
"connection": {
|
||||
@ -71,13 +70,12 @@ def test_user_identifiers_username_as_identifier(snowflake_connect, tmp_path):
|
||||
"username": "TST_USR",
|
||||
"password": "TST_PWD",
|
||||
},
|
||||
"email_as_user_identifier": False,
|
||||
},
|
||||
PipelineContext("run-id"),
|
||||
)
|
||||
assert (
|
||||
source.identifiers.get_user_identifier("username", "username@example.com")
|
||||
== "username"
|
||||
== "username@example.com"
|
||||
)
|
||||
assert source.identifiers.get_user_identifier("username", None) == "username"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user