Skip to main content

A CLI tool for Dataplex Semantic Model operations with YAML validation

Project description

dataplex-sm-cli

A powerful and extensible CLI tool for managing Dataplex Semantic Models. This CLI can be installed in any Python project via pip.

Features

  • 🚀 Easy installation via pip
  • 🎯 Semantic model management (create, delete, list)
  • ⚙️ Configuration management
  • 🔧 Extensible command structure
  • ✅ YAML validation using js-yaml (npm package)
  • 📝 Well-documented commands with examples

Installation

Requirements

  • Python 3.8+
  • Node.js 14+ (required for YAML validation feature)
  • npm (comes with Node.js)

From Source (Development)

# Clone the repository
git clone https://github.com/Sachin-Rungta/dataplex-sm-cli.git
cd dataplex-sm-cli

# Install Node.js dependencies for YAML validator
npm install

# Install Python package in development mode
pip install -e .

From PyPI (Once Published)

pip install dataplex-sm-cli

In Any Project

Once installed, you can use the CLI from any directory:

pip install dataplex-sm-cli
dataplex-sm --help

Usage

Get Help

dataplex-sm --help
dataplex-sm --version

Model Commands

Create a semantic model

dataplex-sm model create --name my-model --description "My model" --project my-project

List all models

dataplex-sm model list --project my-project

Delete a model

dataplex-sm model delete --name my-model --project my-project

Configuration Commands

Set a configuration value

dataplex-sm config set --key project-id --value my-project

Get configuration

dataplex-sm config get --key project-id
dataplex-sm config get  # Get all values

YAML Validation Commands

Validate YAML files using the js-yaml npm package:

dataplex-sm validate-yaml config.yaml
dataplex-sm validate-yaml path/to/file.yaml

The validator will:

  • Check YAML syntax validity
  • Parse YAML structure
  • Report errors with line and column numbers
  • Display clear success/failure messages

Development

Setup Development Environment

# Install with dev dependencies
pip install -e ".[dev]"

Run Tests

pytest tests/
pytest tests/ --cov=dataplex_sm_cli  # With coverage

Code Quality

# Format code
black dataplex_sm_cli/ tests/

# Lint
flake8 dataplex_sm_cli/ tests/

# Type checking
mypy dataplex_sm_cli/

Project Structure

dataplex-sm-cli/
├── dataplex_sm_cli/
│   ├── __init__.py          # Package initialization
│   └── cli.py               # Main CLI implementation
├── tests/
│   ├── __init__.py
│   └── test_cli.py          # CLI tests
├── pyproject.toml           # Modern Python project config
├── setup.py                 # Setup script for pip
├── README.md                # This file
└── .gitignore               # Git ignore rules

Adding New Commands

To add new commands to the CLI, edit dataplex_sm_cli/cli.py:

@main.command()
@click.option("--option", help="Option help text")
def my_command(option):
    """Command help text."""
    click.echo(f"Executing my-command with option: {option}")

Then add tests in tests/test_cli.py:

def test_my_command(runner):
    result = runner.invoke(main, ["my-command", "--option", "value"])
    assert result.exit_code == 0
    assert "expected output" in result.output

Publishing to PyPI

# Build the package
pip install build
python -m build

# Upload to PyPI (requires credentials)
pip install twine
twine upload dist/*

Requirements

  • Python 3.8+
  • Node.js 14+ (for YAML validation)
  • npm
  • click >= 8.0.0 (Python)
  • js-yaml >= 4.1.0 (npm)

NPM Dependencies

The project uses the following npm package for YAML validation:

  • js-yaml: A JavaScript YAML parser and serializer with excellent error reporting

Install npm dependencies with:

npm install

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a pull request.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dataplex_sm_cli-0.2.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dataplex_sm_cli-0.2.0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file dataplex_sm_cli-0.2.0.tar.gz.

File metadata

  • Download URL: dataplex_sm_cli-0.2.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for dataplex_sm_cli-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5637ba23779b1b23aba6513b30d1c32e5291fdb496be0ab7e4ff3ddd6855b151
MD5 5ccc30e0a1835ceb09c81da3e046baa5
BLAKE2b-256 cb01cfe5eeffce15e10e8c8b7864667e15313184280325940413dca9064137f4

See more details on using hashes here.

File details

Details for the file dataplex_sm_cli-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dataplex_sm_cli-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de68bc53bb5023b6464d30b30fb7f9ae7a455cee336a8bda03f1fb127c262a7c
MD5 bc73647466ae97cc4dc6df69b64ad8eb
BLAKE2b-256 52f15156464275744f4d693b2315526ae3889ecb0c6b24793841f67cb4f6b702

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page