Skip to content

Commit

Permalink
migrate performance snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-rp committed Sep 11, 2023
1 parent 9ac7ee9 commit 180de6e
Show file tree
Hide file tree
Showing 12 changed files with 316 additions and 166 deletions.
3 changes: 3 additions & 0 deletions dlt/common/configuration/providers/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ class StringTomlProvider(BaseTomlProvider):
def __init__(self, toml_string: str) -> None:
super().__init__(StringTomlProvider.loads(toml_string))

def update(self, toml_string: str) -> None:
self._toml = self.loads(toml_string)

def dumps(self) -> str:
return tomlkit.dumps(self._toml)

Expand Down
11 changes: 0 additions & 11 deletions docs/snippets/reference/.dlt/config.toml

This file was deleted.

Empty file.
16 changes: 0 additions & 16 deletions docs/snippets/reference/parallel_load/.dlt/config.toml

This file was deleted.

Empty file.
34 changes: 0 additions & 34 deletions docs/snippets/reference/parallel_load/parallel_load.py

This file was deleted.

27 changes: 0 additions & 27 deletions docs/snippets/reference/performance_chunking.py

This file was deleted.

39 changes: 0 additions & 39 deletions docs/snippets/reference/performance_parallel_extract.py

This file was deleted.

13 changes: 0 additions & 13 deletions docs/snippets/reference/test_reference_snippets.py

This file was deleted.

8 changes: 6 additions & 2 deletions docs/website/docs/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,25 @@
from dlt.common.configuration.container import Container

# patch which providers to enable
from dlt.common.configuration.providers import ConfigProvider, EnvironProvider, SecretsTomlProvider, ConfigTomlProvider
from dlt.common.configuration.providers import StringTomlProvider, EnvironProvider, SecretsTomlProvider, ConfigTomlProvider
from dlt.common.configuration.specs.config_providers_context import ConfigProvidersContext, ConfigProvidersConfiguration

from tests.utils import patch_home_dir, autouse_test_storage, preserve_environ, duckdb_pipeline_location, wipe_pipeline

string_toml_provider = StringTomlProvider("")

@pytest.fixture(autouse=True)
def setup_tests(request):
# always set working dir to main website folder
dname = os.path.dirname(request.module.__file__)
config_dir = dname + "/.dlt"

# clear string toml provider
string_toml_provider.update("")

# inject provider context so the original providers are restored at the end
def _initial_providers():
return [EnvironProvider(), SecretsTomlProvider(project_dir=config_dir, add_global_config=False), ConfigTomlProvider(project_dir=config_dir, add_global_config=False)]
return [string_toml_provider, EnvironProvider(), SecretsTomlProvider(project_dir=config_dir, add_global_config=False), ConfigTomlProvider(project_dir=config_dir, add_global_config=False)]

glob_ctx = ConfigProvidersContext()
glob_ctx.providers = _initial_providers()
Expand Down
Loading

0 comments on commit 180de6e

Please sign in to comment.