-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use reference keys instead of relations (#4410)
- Loading branch information
Nathaniel May
authored
Dec 2, 2021
1 parent
c675c2d
commit 9bdf5fe
Showing
7 changed files
with
47 additions
and
38 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,24 @@ | ||
# this module exists to resolve circular imports with the events module | ||
|
||
from collections import namedtuple | ||
from typing import Optional | ||
|
||
|
||
_ReferenceKey = namedtuple('_ReferenceKey', 'database schema identifier') | ||
|
||
|
||
def lowercase(value: Optional[str]) -> Optional[str]: | ||
if value is None: | ||
return None | ||
else: | ||
return value.lower() | ||
|
||
|
||
def _make_key(relation) -> _ReferenceKey: | ||
"""Make _ReferenceKeys with lowercase values for the cache so we don't have | ||
to keep track of quoting | ||
""" | ||
# databases and schemas can both be None | ||
return _ReferenceKey(lowercase(relation.database), | ||
lowercase(relation.schema), | ||
lowercase(relation.identifier)) |
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