-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sc-28944] Provide config to link user name to email
- Loading branch information
1 parent
167ccb7
commit f6070ab
Showing
9 changed files
with
47 additions
and
16 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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "metaphor-connectors" | ||
version = "0.14.107" | ||
version = "0.14.108" | ||
license = "Apache-2.0" | ||
description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app." | ||
authors = ["Metaphor <[email protected]>"] | ||
|
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 |
---|---|---|
|
@@ -64,7 +64,10 @@ def dummy_config(**args): | |
password="", | ||
output=OutputConfig(), | ||
**args, | ||
query_log=PostgreSQLQueryLogConfig(excluded_usernames={"foo"}), | ||
query_log=PostgreSQLQueryLogConfig( | ||
excluded_usernames={"foo"}, | ||
username_to_email={"metaphor": "[email protected]"}, | ||
), | ||
) | ||
|
||
|
||
|
@@ -77,7 +80,7 @@ def dummy_config(**args): | |
default_database="metaphor", | ||
default_schema=None, | ||
duration=55.66, | ||
email=None, | ||
email="[email protected]", | ||
metadata=None, | ||
parsing=None, | ||
platform=DataPlatform.POSTGRESQL, | ||
|
@@ -270,7 +273,7 @@ def test_alter_rename(): | |
default_database="metaphor", | ||
default_schema=None, | ||
duration=55.66, | ||
email=None, | ||
email="[email protected]", | ||
metadata=None, | ||
parsing=None, | ||
platform=DataPlatform.POSTGRESQL, | ||
|
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
"_id": "REDSHIFT:7086", | ||
"bytesRead": 6500.0, | ||
"duration": -338161298.308308, | ||
"email": "[email protected]", | ||
"platform": "REDSHIFT", | ||
"queryId": "7086", | ||
"rowsRead": 7155.0, | ||
|
@@ -17,16 +18,17 @@ | |
"table": "table1" | ||
} | ||
], | ||
"targets": [], | ||
"sql": "select * from schema1.table1", | ||
"sqlHash": "fbbd533367fe766d71a48425c5c48654", | ||
"startTime": "2010-06-26T10:07:18.014673", | ||
"userId": "aZUytYDMFTryuKyWtbEM" | ||
"targets": [], | ||
"userId": "user1" | ||
}, | ||
{ | ||
"_id": "REDSHIFT:9910", | ||
"bytesRead": 176.0, | ||
"duration": -217012182.227927, | ||
"email": "[email protected]", | ||
"platform": "REDSHIFT", | ||
"queryId": "9910", | ||
"rowsRead": 4617.0, | ||
|
@@ -38,11 +40,11 @@ | |
"table": "table2" | ||
} | ||
], | ||
"targets": [], | ||
"sql": "select * from schema2.table2", | ||
"sqlHash": "9f98db863e022a1b0c8b0895c1d4dec1", | ||
"startTime": "2003-10-01T10:15:51.904151", | ||
"userId": "IevfvBUzEVUDrTbaIWKY" | ||
"targets": [], | ||
"userId": "user2" | ||
} | ||
] | ||
} | ||
|
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
from metaphor.common.base_config import OutputConfig | ||
from metaphor.common.event_util import EventUtil | ||
from metaphor.models.metadata_change_event import DataPlatform | ||
from metaphor.postgresql.config import QueryLogConfig | ||
from metaphor.redshift.access_event import AccessEvent | ||
from metaphor.redshift.config import RedshiftRunConfig | ||
from metaphor.redshift.extractor import RedshiftExtractor | ||
|
@@ -44,12 +45,11 @@ def test_dataset_platform(): | |
|
||
|
||
def test_collect_query_logs(test_root_dir: str) -> None: | ||
# Random stuff generated with polyfactory | ||
access_events = [ | ||
AccessEvent( | ||
user_id=7610, | ||
query_id=7086, | ||
usename="aZUytYDMFTryuKyWtbEM", | ||
usename="user1", | ||
rows=7155, | ||
bytes=6500, | ||
querytxt="select * from schema1.table1", | ||
|
@@ -60,7 +60,7 @@ def test_collect_query_logs(test_root_dir: str) -> None: | |
AccessEvent( | ||
user_id=8902, | ||
query_id=9910, | ||
usename="IevfvBUzEVUDrTbaIWKY", | ||
usename="user2", | ||
rows=4617, | ||
bytes=176, | ||
querytxt="select * from schema2.table2", | ||
|
@@ -93,7 +93,14 @@ async def __anext__(self): | |
mock_connect_database.return_value = MagicMock() | ||
mock_fetch_access_event.return_value = AsyncIterator() | ||
|
||
extractor = RedshiftExtractor(dummy_config()) | ||
config = dummy_config() | ||
config.query_log = QueryLogConfig( | ||
username_to_email={ | ||
"user1": "[email protected]", | ||
"user2": "[email protected]", | ||
} | ||
) | ||
extractor = RedshiftExtractor(config) | ||
extractor._included_databases = included_dbs | ||
extractor._datasets["db1.schema1.table1"] = 1 | ||
extractor._datasets["db2.schema2.table2"] = 1 | ||
|