-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from scale-vector/rfix/pipeline-api-v2
pre api v2 dlt engine update
- Loading branch information
Showing
180 changed files
with
5,383 additions
and
2,465 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
common_version = "0.1.0" | ||
loader_version = "0.1.0" | ||
unpacker_version = "0.1.0" | ||
normalize_version = "0.1.0" |
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,34 +1,39 @@ | ||
import decimal # noqa: I251 | ||
from contextlib import contextmanager | ||
from typing import Iterator | ||
from decimal import ROUND_HALF_UP, Decimal, DefaultContext, DivisionByZero, InvalidOperation, localcontext, Context, ConversionSyntax # noqa: I251 | ||
from decimal import ROUND_HALF_UP, Decimal, Inexact, DivisionByZero, DefaultContext, InvalidOperation, localcontext, Context, Subnormal, ConversionSyntax # noqa: I251 | ||
|
||
|
||
DEFAULT_NUMERIC_PRECISION = 38 | ||
DEFAULT_NUMERIC_SCALE = 9 | ||
|
||
NUMERIC_DEFAULT_QUANTIZER = Decimal("1." + "0" * DEFAULT_NUMERIC_SCALE) | ||
|
||
DefaultContext.rounding = ROUND_HALF_UP | ||
# use small caps for exponent | ||
DefaultContext.capitals = 0 | ||
# use 128 bit precision which is default in most databases | ||
DefaultContext.prec = DEFAULT_NUMERIC_PRECISION | ||
# prevent NaN to be returned | ||
DefaultContext.traps[InvalidOperation] = True | ||
# prevent Inf to be returned | ||
DefaultContext.traps[DivisionByZero] = True | ||
decimal.setcontext(DefaultContext) | ||
|
||
def default_context(c: Context, precision: int) -> Context: | ||
c.rounding = ROUND_HALF_UP | ||
# prevent NaN to be returned | ||
c.traps[InvalidOperation] = True | ||
# prevent Inf to be returned | ||
c.traps[DivisionByZero] = True | ||
# force exact operations - prevents unknown rounding | ||
c.traps[Inexact] = True | ||
c.traps[Subnormal] = True | ||
# use 128 bit precision which is default in most databases (DEFAULT_NUMERIC_PRECISION) | ||
c.prec = precision | ||
|
||
return c | ||
|
||
|
||
@contextmanager | ||
def numeric_default_context(precision: int = DEFAULT_NUMERIC_PRECISION) -> Iterator[Context]: | ||
with localcontext() as c: | ||
c.prec = precision | ||
yield c | ||
yield default_context(c, precision) | ||
|
||
|
||
def numeric_default_quantize(v: Decimal) -> Decimal: | ||
if v == 0: | ||
return v | ||
return v.quantize(NUMERIC_DEFAULT_QUANTIZER) | ||
c = decimal.getcontext().copy() | ||
c.traps[Inexact] = False | ||
return v.quantize(NUMERIC_DEFAULT_QUANTIZER, context=c) |
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,11 +1,11 @@ | ||
from .basic_configuration import BasicConfiguration # noqa: F401 | ||
from .unpacking_volume_configuration import UnpackingVolumeConfiguration, ProductionUnpackingVolumeConfiguration # noqa: F401 | ||
from .loading_volume_configuration import LoadingVolumeConfiguration, ProductionLoadingVolumeConfiguration # noqa: F401 | ||
from .run_configuration import RunConfiguration, BaseConfiguration # noqa: F401 | ||
from .normalize_volume_configuration import NormalizeVolumeConfiguration, ProductionNormalizeVolumeConfiguration # noqa: F401 | ||
from .load_volume_configuration import LoadVolumeConfiguration, ProductionLoadVolumeConfiguration # noqa: F401 | ||
from .schema_volume_configuration import SchemaVolumeConfiguration, ProductionSchemaVolumeConfiguration # noqa: F401 | ||
from .pool_runner_configuration import PoolRunnerConfiguration, TPoolType # noqa: F401 | ||
from .gcp_client_configuration import GcpClientConfiguration, GcpClientProductionConfiguration # noqa: F401 | ||
from .postgres_configuration import PostgresConfiguration, PostgresProductionConfiguration # noqa: F401 | ||
from .utils import make_configuration, TSecretValue, open_configuration_file # noqa: F401 | ||
from .gcp_client_credentials import GcpClientCredentials # noqa: F401 | ||
from .postgres_credentials import PostgresCredentials # noqa: F401 | ||
from .utils import make_configuration, TSecretValue # noqa: F401 | ||
|
||
from .exceptions import ( # noqa: F401 | ||
ConfigEntryMissingException, ConfigEnvValueCannotBeCoercedException, ConfigIntegrityException, ConfigFileNotFoundException) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,30 @@ | ||
from dlt.common.typing import StrAny, StrStr | ||
from dlt.common.configuration import BaseConfiguration | ||
from dlt.common.configuration.utils import TSecretValue | ||
|
||
|
||
class GcpClientCredentials(BaseConfiguration): | ||
PROJECT_ID: str = None | ||
BQ_CRED_TYPE: str = "service_account" | ||
PRIVATE_KEY: TSecretValue = None | ||
TOKEN_URI: str = "https://oauth2.googleapis.com/token" | ||
CLIENT_EMAIL: str = None | ||
|
||
HTTP_TIMEOUT: float = 15.0 | ||
RETRY_DEADLINE: float = 600 | ||
|
||
@classmethod | ||
def check_integrity(cls) -> None: | ||
if cls.PRIVATE_KEY and cls.PRIVATE_KEY[-1] != "\n": | ||
# must end with new line, otherwise won't be parsed by Crypto | ||
cls.PRIVATE_KEY = TSecretValue(cls.PRIVATE_KEY + "\n") | ||
|
||
@classmethod | ||
def as_credentials(cls) -> StrAny: | ||
return { | ||
"type": cls.BQ_CRED_TYPE, | ||
"project_id": cls.PROJECT_ID, | ||
"private_key": cls.PRIVATE_KEY, | ||
"token_uri": cls.TOKEN_URI, | ||
"client_email": cls.CLIENT_EMAIL | ||
} |
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,11 @@ | ||
import os | ||
|
||
from dlt.common.configuration.run_configuration import BaseConfiguration | ||
|
||
|
||
class LoadVolumeConfiguration(BaseConfiguration): | ||
LOAD_VOLUME_PATH: str = os.path.join("_storage", "load") # path to volume where files to be loaded to analytical storage are stored | ||
DELETE_COMPLETED_JOBS: bool = False # if set to true the folder with completed jobs will be deleted | ||
|
||
class ProductionLoadVolumeConfiguration(LoadVolumeConfiguration): | ||
LOAD_VOLUME_PATH: str = None |
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
dlt/common/configuration/normalize_volume_configuration.py
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,11 @@ | ||
import os | ||
|
||
from dlt.common.configuration import BaseConfiguration | ||
|
||
|
||
class NormalizeVolumeConfiguration(BaseConfiguration): | ||
NORMALIZE_VOLUME_PATH: str = os.path.join("_storage", "normalize") # path to volume where normalized loader files will be stored | ||
|
||
|
||
class ProductionNormalizeVolumeConfiguration(NormalizeVolumeConfiguration): | ||
NORMALIZE_VOLUME_PATH: str = None |
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 was deleted.
Oops, something went wrong.
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,22 @@ | ||
from dlt.common.configuration import BaseConfiguration | ||
from dlt.common.configuration.utils import TSecretValue | ||
from dlt.common.typing import StrAny | ||
|
||
|
||
class PostgresCredentials(BaseConfiguration): | ||
DBNAME: str = None | ||
PASSWORD: TSecretValue = None | ||
USER: str = None | ||
HOST: str = None | ||
PORT: int = 5439 | ||
CONNECT_TIMEOUT: int = 15 | ||
|
||
@classmethod | ||
def check_integrity(cls) -> None: | ||
cls.DBNAME = cls.DBNAME.lower() | ||
# cls.DEFAULT_DATASET = cls.DEFAULT_DATASET.lower() | ||
cls.PASSWORD = TSecretValue(cls.PASSWORD.strip()) | ||
|
||
@classmethod | ||
def as_credentials(cls) -> StrAny: | ||
return cls.as_dict() |
Oops, something went wrong.