From b3c60b631a9fe8d9dffb1fa5cbfc44454c5fb03d Mon Sep 17 00:00:00 2001 From: skshetry <18718008+skshetry@users.noreply.github.com> Date: Fri, 9 Aug 2024 23:51:52 +0545 Subject: [PATCH] stabilize import db (#5293) Merge when https://github.com/iterative/dvc/pull/10510 gets released. Closes #5087. --- content/docs/command-reference/import-db.md | 6 ------ content/docs/command-reference/update.md | 4 ++-- content/docs/user-guide/project-structure/dvc-files.md | 10 ++++++++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/content/docs/command-reference/import-db.md b/content/docs/command-reference/import-db.md index 285db1112d..25dd3788c7 100644 --- a/content/docs/command-reference/import-db.md +++ b/content/docs/command-reference/import-db.md @@ -1,11 +1,5 @@ # import-db - - -This is an experimental command, and is subject to breaking changes. - - - Snapshot a table or a SQL query results from a database into CSV/JSON format. ```usage diff --git a/content/docs/command-reference/update.md b/content/docs/command-reference/update.md index e81a5eba1a..359727a60c 100644 --- a/content/docs/command-reference/update.md +++ b/content/docs/command-reference/update.md @@ -20,8 +20,8 @@ positional arguments: ## Description -After creating import stages (`.dvc` files) with `dvc import` or -`dvc import-url`, the data source can change. Use `dvc update` to bring these +After creating import stages (`.dvc` files) with `dvc import`, `dvc import-url`, +or `dvc import-db`, the data source can change. Use `dvc update` to bring these imported files or directories up to date. To indicate which import stages to update, we can specify the corresponding diff --git a/content/docs/user-guide/project-structure/dvc-files.md b/content/docs/user-guide/project-structure/dvc-files.md index 6f3bbf958e..8024ce339d 100644 --- a/content/docs/user-guide/project-structure/dvc-files.md +++ b/content/docs/user-guide/project-structure/dvc-files.md @@ -74,6 +74,7 @@ The following subfields may be present under `deps` entries: | `size` | Size of the file or directory (sum of all files). | | `nfiles` | If this dependency is a directory, the number of files inside (recursive). | | `repo` | Only in external dependencies created with `dvc import`: It can contain `url`, `rev`, `rev_lock`, `config` and `remote` (detailed below). | +| `db` | Only in db dependencies created with `dvc import-db`: It can contain `connection`, `file_format`, `query` and `table` (detailed below). | ### Dependency `repo` subfields: @@ -85,4 +86,13 @@ The following subfields may be present under `deps` entries: | `config` | When `dvc import --config` is used: Path to a [config file](/doc/command-reference/config) that will be merged with the config in the target repository. When both `--remote` and `--remote-config` are used: config options that will be merged with the config in the target repository. See examples section in`dvc import`. | | `remote` | Only when `dvc import --remote` or `--remote-config` is used: name of the `dvc remote` to set as a default or remote config options to merge with a default remote's config in the target repository. See examples section in `dvc import`. | +### Dependency `db` subfields: + +| Field | Description | +| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `connection` | Name of the connection to use. The connection has to be set in the config before use. See [Database Connections](/doc/command-reference/import-db#database-connections). | +| `query` | SQL query to snapshot. It is only set if `--sql` option was used on `dvc import-db`. `dvc update` will use this field to re-import. | +| `table` | Name of the database table to snapshot. It is only set if `--table` option was used on `dvc import-db`. `dvc update` will use this field to re-import. | +| `file_format` | Export format to use. At the moment, it can be set to either `csv` or `json`. | + [git revision]: https://git-scm.com/docs/revisions