Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
usefulalgorithm committed Sep 24, 2024
1 parent f6070ab commit 832676e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion metaphor/kafka/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class KafkaConfig(BaseConfig):
"""

bootstrap_servers: List[KafkaBootstrapServer] = dataclass_field(
default_factory=lambda: []
default_factory=list
)
"""
The Kafka bootstrap servers / brokers. Cannot be empty.
Expand Down
8 changes: 8 additions & 0 deletions metaphor/postgresql/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from dataclasses import field
from typing import Dict, Optional, Set

from pydantic import field_validator
from pydantic.dataclasses import dataclass

from metaphor.common.aws import AwsCredentials
Expand Down Expand Up @@ -28,6 +29,13 @@ class QueryLogConfig:
# Config to link user name to email so that Metaphor can display each query's issuer.
username_to_email: Dict[str, str] = field(default_factory=dict)

@field_validator("username_to_email")
def _normalize_emails(cls, username_to_email: Dict[str, str]):
return {
k: v.lower()
for k, v
in username_to_email.items()
}

@dataclass(config=ConnectorConfig)
class BasePostgreSQLRunConfig(BaseConfig):
Expand Down
2 changes: 1 addition & 1 deletion tests/redshift/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def __anext__(self):
config.query_log = QueryLogConfig(
username_to_email={
"user1": "[email protected]",
"user2": "[email protected]",
"user2": "[email protected]",
}
)
extractor = RedshiftExtractor(config)
Expand Down

0 comments on commit 832676e

Please sign in to comment.