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)
- npm (comes with Node.js)
Install Node.js
Linux (Ubuntu/Debian):
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt-get install -y nodejs
macOS (Homebrew):
brew install node
Windows: Download from https://nodejs.org/ or use:
choco install nodejs
Verify Installation:
node --version
npm --version
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dataplex_sm_cli-0.2.1.tar.gz.
File metadata
- Download URL: dataplex_sm_cli-0.2.1.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
970830bc8c9166cfae443b4434b03cf7b3c03faa270de3890210573db18df525
|
|
| MD5 |
4e10b3ee9de6fbcf666916f369cf4452
|
|
| BLAKE2b-256 |
597611a6576d71aeb21949c366935601134b725cc3ce3d5a894bd8c658bb98db
|
File details
Details for the file dataplex_sm_cli-0.2.1-py3-none-any.whl.
File metadata
- Download URL: dataplex_sm_cli-0.2.1-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abb8283278e9652d3a13320884455f3704fd341b32cd8d66de5f764423e34c51
|
|
| MD5 |
c6ebda1062eb60c6f451d60c08ff004f
|
|
| BLAKE2b-256 |
b63d06c400567f16d9f72b35a7f1dde9d8592f71083bedc3a8226f2232d84a3c
|