From 22d1feffbafe80dc73dbcb80ac6cb395665cee63 Mon Sep 17 00:00:00 2001 From: AstrakhantsevaAA Date: Thu, 4 Jan 2024 13:32:09 +0100 Subject: [PATCH] update documentation --- dlt/__init__.py | 2 +- dlt/cli/magics.py | 2 +- docs/website/docs/reference/notebook-magic.md | 61 ++++++++++++------- 3 files changed, 40 insertions(+), 25 deletions(-) diff --git a/dlt/__init__.py b/dlt/__init__.py index a93e4a46ac..628c4fb843 100644 --- a/dlt/__init__.py +++ b/dlt/__init__.py @@ -44,7 +44,7 @@ try: from dlt.cli.magics import register_notebook_magics register_notebook_magics() -except: +except Exception: pass pipeline = _pipeline diff --git a/dlt/cli/magics.py b/dlt/cli/magics.py index 6959be25d4..91c2afdc3a 100644 --- a/dlt/cli/magics.py +++ b/dlt/cli/magics.py @@ -160,7 +160,7 @@ def pipeline(self, line: str) -> t.Any: @magic_arguments() @argument("--file_path", type=str, help="Schema file name, in yaml or json format") - @argument("--format", type=str, help="File format") + @argument("--format", type=str, choices=["json", "yaml"], default="yaml", help="File format") @argument("--remove_defaults", type=str, help="Remove defaults") @line_magic def schema(self, line: str) -> t.Any: diff --git a/docs/website/docs/reference/notebook-magic.md b/docs/website/docs/reference/notebook-magic.md index 45f8e8a846..a0a2c78ee0 100644 --- a/docs/website/docs/reference/notebook-magic.md +++ b/docs/website/docs/reference/notebook-magic.md @@ -17,39 +17,32 @@ This means that the pipeline will run without any prompts. If you want to run the pipeline with prompts, you can use command line arguments. ::: -## Installation - -You can install `dlt` and its notebook dependencies using `pip`: - -```bash -pip install dlt[notebook] -``` - ## `%pipeline` In an IPython notebook, you can use the `%pipeline` magic command to execute the `dlt pipeline` command. This command allows managing of pipelines. ```ipython -%pipeline --operation +%pipeline --operation --pipeline_name ``` Possible operations are: - 1. `info` - 2. `list-pipelines` - 3. `show` - 4. `info` - 5. `trace` - 6. `failed-jobs` - 7. `drop-pending-packages` - 8. `load-package` - 9. `drop` - 10. `schema` +1. `list-pipelines` +2. `info` +3. `sync` +4. `trace` +5. `failed-jobs` +6. `drop-pending-packages` +7. `schema` -Example: +Examples: ```ipython -%pipeline --operation info +%pipeline --operation list-pipelines +``` + +```ipython +%pipeline --operation info --pipeline_name chess ``` For more information on these commands, check `dlt` [CLI documentation](command-line-interface). @@ -62,14 +55,36 @@ This command sets up a new `dlt` pipeline script that transfers data from a `sou ```ipython -%init --source --destination +%init --source_name --destination_name ``` Example: ```ipython -%init --source pokemon --destination duckdb +%init --source_name pokemon --destination_name duckdb +``` + +## `%settings` + +Enable or disable telemetry globally. + +```ipython +%settings --enable-telemetry +``` +or +```ipython +%settings --disable-telemetry +``` + +## `%schema` +This command shows, converts and upgrades schemas. + +```ipython +%schema --file_path --format json ``` +Options: +- `--format`: Display schema in yaml or json format. Defaults to `yaml`. +- `--remove-defaults`: Does not show default hint values. ## `%dlt_version`