-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save original data on translation error (#335)
* port dumbed-down implementation from experiments branch. * pin timescale/pg docker img version to latest known to be working w/ ql. * pin timescale/pg docker img version to latest known to be working w/ ql. * upgrade all timescale test images to latest stable version. * factor out safe reading of env vars. * move reading of env vars out of translator. * document env vars. * implement optional saving of original data. * store original entities and associated recovery metadata as json.
- Loading branch information
Showing
17 changed files
with
596 additions
and
70 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,27 @@ | ||
import logging | ||
import os | ||
|
||
from utils.cfgreader import EnvReader, BoolVar, IntVar | ||
|
||
|
||
DEFAULT_LIMIT_VAR = 'DEFAULT_LIMIT' | ||
KEEP_RAW_ENTITY_VAR = 'KEEP_RAW_ENTITY' | ||
|
||
|
||
class SQLTranslatorConfig: | ||
""" | ||
Provide access to SQL Translator config values. | ||
""" | ||
|
||
def __init__(self, env: dict = os.environ): | ||
self.store = EnvReader(var_store=env, | ||
log=logging.getLogger(__name__).info) | ||
|
||
def default_limit(self) -> int: | ||
fallback_limit = 10000 | ||
var = IntVar(DEFAULT_LIMIT_VAR, default_value=fallback_limit) | ||
return self.store.safe_read(var) | ||
|
||
def keep_raw_entity(self) -> bool: | ||
var = BoolVar(KEEP_RAW_ENTITY_VAR, False) | ||
return self.store.safe_read(var) |
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
Oops, something went wrong.