dm-cli


Namedm-cli JSON
Version 1.7.1 PyPI version JSON
download
home_pagehttps://github.com/equinor/dm-cli
SummaryNone
upload_time2024-05-23 11:32:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Data Modelling CLI Tool [![PyPi version](https://img.shields.io/pypi/v/dm-cli)](https://pypi.org/project/dm-cli) [![PyPi downloads](https://img.shields.io/pypi/dm/dm-cli)](https://pypi.org/project/dm-cli) ![Visitors](https://api.visitorbadge.io/api/visitors?path=equinor%2Fdm-cli&countColor=%23263759&style=flat)

CLI tool for working with [Data Modelling Storage Service](https://github.com/equinor/data-modelling-storage-service)

## Installing
> [!NOTE]
> Requires Python version >= 3.11

Install the tool via pip
```sh
$ pip3 install dm-cli
```

After a successful install, the program `'dm'` will be available in your python environment

## Usage

```txt
Usage: dm [OPTIONS] COMMAND [ARGS]...

Command Line Interface (CLI) tool for working with the Data Modelling Framework. This tool is mainly used to upload data source definitions, models and
entities, and creating RecipeLink-tables.

╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --force               -f            Force the operation. Overwriting and potentially deleting data.                                                         │
│ --url                 -u      TEXT  URL to the Data Modelling Storage Service (DMSS). [default: http://localhost:5000]                                      │
│ --token               -t      TEXT  Token for authentication against DMSS. [default: no-token]                                                              │
│ --debug               -d            Print stack trace of suppressed exceptions                                                                              │
│ --version             -v            Print version and exit                                                                                                  │
│ --install-completion                Install completion for the current shell.                                                                               │
│ --show-completion                   Show completion for the current shell, to copy it or customize the installation.                                        │
│ --help                              Show this message and exit.                                                                                             │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ create-lookup              Create a named Ui-/StorageRecipe-lookup-table from all RecipeLinks in a package existing in DMSS (requires admin privileges).    │
│ ds                         Import and reset data sources                                                                                                    │
│ entities                   Import, delete, or validate entities and/or blueprints                                                                           │
│ export                     Export one or more entities.                                                                                                     │
│ import-plugin-blueprints   Import blueprints from a plugin into the standard location 'system/Plugins/<plugin-name>'.                                       │
│ reset                      Reset all data sources (deletes and re-uploads all packages to DMSS).                                                            │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

> [!TIP]
> For each of the `commands` listed above, you can run `dm <COMMAND> --help` to see subcommand-specific help messages, e.g. `dm ds import --help` or `dm pkg --help`

### Required directory structure
Certain commands expect a specific directory structure, such as the commands `dm reset`, `dm ds init`, and `dm ds reset`.
For these commands, the `path` argument must be the path to a directory with two subdirectories, `data_sources` and `data`.

```sh
$ tree app
app
├── data
  └── DemoApplicationDataSource
    ├── instances
│     └── demoApplication.json
|     └── models
|       └── DemoApplication.json
└── data_sources
    └── DemoApplicationDataSource.json
```

To add meta information to a package (for example to the models root package), a file with name "package.json" can be placed inside the folder.


### Supported reference syntax
The CLI tool will understand and resolve the following address formats during import.


```bash
# URI - Full absolute path prefixed with protocol
dmss://datasource/package/entity
dmss://datasource/package/subfolder/entity
dmss://datasource/$123-456.attributeName

# Alias - Require dependencies to be defined somewhere in the source tree
ALIAS:package/entity
ALIAS:entity

# Data Source - Relative from the destination data source
/package/entity
/package/subfolder/entity
/$123-456.attributeName

# Package - Relative from the source package
entity
subfolder/entity

# Dotted - Relative from the file (UNIX directory traversal)
./../entity
../subfolder/entity
../../subfolder/entity
```

## Development

```sh
$ python3 -m venv .venv
$ source .venv/bin/activate
# Install the package from local files in edit mode (-e)
$ pip3 install -e .
$ dm --help
```

### Testing

1. Install the dependencies: `pip3 install -r requirements.txt`
2. Install the dev dependencies: `pip3 install -r dev-requirements.txt`
3. Run the tests: `pytest`

## Feedback
Please feel free to leave feedback in issues/PRs.

## Contributing
If you would like to contribute, please read our [Contribution guide](https://equinor.github.io/dm-docs/contributing/).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/equinor/dm-cli",
    "name": "dm-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/4d/82/f426a5c0660891bfb0184d63e2b2bb15e15705326d0c25efa14e6162db40/dm-cli-1.7.1.tar.gz",
    "platform": null,
    "description": "# Data Modelling CLI Tool [![PyPi version](https://img.shields.io/pypi/v/dm-cli)](https://pypi.org/project/dm-cli) [![PyPi downloads](https://img.shields.io/pypi/dm/dm-cli)](https://pypi.org/project/dm-cli) ![Visitors](https://api.visitorbadge.io/api/visitors?path=equinor%2Fdm-cli&countColor=%23263759&style=flat)\n\nCLI tool for working with [Data Modelling Storage Service](https://github.com/equinor/data-modelling-storage-service)\n\n## Installing\n> [!NOTE]\n> Requires Python version >= 3.11\n\nInstall the tool via pip\n```sh\n$ pip3 install dm-cli\n```\n\nAfter a successful install, the program `'dm'` will be available in your python environment\n\n## Usage\n\n```txt\nUsage: dm [OPTIONS] COMMAND [ARGS]...\n\nCommand Line Interface (CLI) tool for working with the Data Modelling Framework. This tool is mainly used to upload data source definitions, models and\nentities, and creating RecipeLink-tables.\n\n\u256d\u2500 Options \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 --force               -f            Force the operation. Overwriting and potentially deleting data.                                                         \u2502\n\u2502 --url                 -u      TEXT  URL to the Data Modelling Storage Service (DMSS). [default: http://localhost:5000]                                      \u2502\n\u2502 --token               -t      TEXT  Token for authentication against DMSS. [default: no-token]                                                              \u2502\n\u2502 --debug               -d            Print stack trace of suppressed exceptions                                                                              \u2502\n\u2502 --version             -v            Print version and exit                                                                                                  \u2502\n\u2502 --install-completion                Install completion for the current shell.                                                                               \u2502\n\u2502 --show-completion                   Show completion for the current shell, to copy it or customize the installation.                                        \u2502\n\u2502 --help                              Show this message and exit.                                                                                             \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n\u256d\u2500 Commands \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256e\n\u2502 create-lookup              Create a named Ui-/StorageRecipe-lookup-table from all RecipeLinks in a package existing in DMSS (requires admin privileges).    \u2502\n\u2502 ds                         Import and reset data sources                                                                                                    \u2502\n\u2502 entities                   Import, delete, or validate entities and/or blueprints                                                                           \u2502\n\u2502 export                     Export one or more entities.                                                                                                     \u2502\n\u2502 import-plugin-blueprints   Import blueprints from a plugin into the standard location 'system/Plugins/<plugin-name>'.                                       \u2502\n\u2502 reset                      Reset all data sources (deletes and re-uploads all packages to DMSS).                                                            \u2502\n\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256f\n```\n\n> [!TIP]\n> For each of the `commands` listed above, you can run `dm <COMMAND> --help` to see subcommand-specific help messages, e.g. `dm ds import --help` or `dm pkg --help`\n\n### Required directory structure\nCertain commands expect a specific directory structure, such as the commands `dm reset`, `dm ds init`, and `dm ds reset`.\nFor these commands, the `path` argument must be the path to a directory with two subdirectories, `data_sources` and `data`.\n\n```sh\n$ tree app\napp\n\u251c\u2500\u2500 data\n  \u2514\u2500\u2500 DemoApplicationDataSource\n    \u251c\u2500\u2500 instances\n\u2502     \u2514\u2500\u2500 demoApplication.json\n|     \u2514\u2500\u2500 models\n|       \u2514\u2500\u2500 DemoApplication.json\n\u2514\u2500\u2500 data_sources\n    \u2514\u2500\u2500 DemoApplicationDataSource.json\n```\n\nTo add meta information to a package (for example to the models root package), a file with name \"package.json\" can be placed inside the folder.\n\n\n### Supported reference syntax\nThe CLI tool will understand and resolve the following address formats during import.\n\n\n```bash\n# URI - Full absolute path prefixed with protocol\ndmss://datasource/package/entity\ndmss://datasource/package/subfolder/entity\ndmss://datasource/$123-456.attributeName\n\n# Alias - Require dependencies to be defined somewhere in the source tree\nALIAS:package/entity\nALIAS:entity\n\n# Data Source - Relative from the destination data source\n/package/entity\n/package/subfolder/entity\n/$123-456.attributeName\n\n# Package - Relative from the source package\nentity\nsubfolder/entity\n\n# Dotted - Relative from the file (UNIX directory traversal)\n./../entity\n../subfolder/entity\n../../subfolder/entity\n```\n\n## Development\n\n```sh\n$ python3 -m venv .venv\n$ source .venv/bin/activate\n# Install the package from local files in edit mode (-e)\n$ pip3 install -e .\n$ dm --help\n```\n\n### Testing\n\n1. Install the dependencies: `pip3 install -r requirements.txt`\n2. Install the dev dependencies: `pip3 install -r dev-requirements.txt`\n3. Run the tests: `pytest`\n\n## Feedback\nPlease feel free to leave feedback in issues/PRs.\n\n## Contributing\nIf you would like to contribute, please read our [Contribution guide](https://equinor.github.io/dm-docs/contributing/).\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": null,
    "version": "1.7.1",
    "project_urls": {
        "Homepage": "https://github.com/equinor/dm-cli"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1f21eded3d50d3052ba916988a84c5343bb63bd9d738dea5e7b42019a55ebd2",
                "md5": "551e0c258bcd31bae050f43d3ed5d915",
                "sha256": "7c94003de89b70bcaf2dab806d0a35f7f21f3c91da507ae8a21ea6010d83b73e"
            },
            "downloads": -1,
            "filename": "dm_cli-1.7.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "551e0c258bcd31bae050f43d3ed5d915",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 168307,
            "upload_time": "2024-05-23T11:32:26",
            "upload_time_iso_8601": "2024-05-23T11:32:26.021495Z",
            "url": "https://files.pythonhosted.org/packages/d1/f2/1eded3d50d3052ba916988a84c5343bb63bd9d738dea5e7b42019a55ebd2/dm_cli-1.7.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4d82f426a5c0660891bfb0184d63e2b2bb15e15705326d0c25efa14e6162db40",
                "md5": "70a86cd447e06e5b6b3e5002f0a2bb48",
                "sha256": "972f24c81021b026063648fa1dfd3082b2504bf7987f92dc28122c489575c50a"
            },
            "downloads": -1,
            "filename": "dm-cli-1.7.1.tar.gz",
            "has_sig": false,
            "md5_digest": "70a86cd447e06e5b6b3e5002f0a2bb48",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 86207,
            "upload_time": "2024-05-23T11:32:27",
            "upload_time_iso_8601": "2024-05-23T11:32:27.905178Z",
            "url": "https://files.pythonhosted.org/packages/4d/82/f426a5c0660891bfb0184d63e2b2bb15e15705326d0c25efa14e6162db40/dm-cli-1.7.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-23 11:32:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "equinor",
    "github_project": "dm-cli",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "dm-cli"
}
        
Elapsed time: 0.23790s