Skip to main content

Command-line interface for Palantir Foundry APIs

Project description

pltr-cli

A command-line interface tool for interacting with Palantir Foundry APIs.

Overview

pltr-cli provides a streamlined way to interact with Palantir Foundry services from the command line. Built on top of the official foundry-platform-sdk, it offers intuitive commands for dataset management, ontology operations, SQL queries, and more.

Features

  • 🔐 Secure Authentication: Support for both token and OAuth2 authentication with secure credential storage
  • 📊 Dataset Management: List, create, upload, and download datasets with progress indicators
  • 🔍 Ontology Operations: Search and interact with ontology objects and actions
  • 📝 SQL Queries: Execute SQL queries directly from the command line
  • 🎨 Rich Output: Beautiful terminal output with table formatting and color support
  • 👤 Multi-Profile Support: Manage multiple Foundry environments with profile configurations

Installation

Using pip

pip install pltr-cli

From source

# Clone the repository
git clone https://github.com/anjor/pltr-cli.git
cd pltr-cli

# Install with uv
uv sync

# Run the CLI
uv run pltr --help

Quick Start

Configure Authentication

Set up your Foundry credentials:

pltr configure --profile production

This will prompt you for:

  • Foundry host URL
  • Authentication method (token or OAuth2)
  • Credentials

Basic Usage

# List datasets
pltr dataset list

# Upload a file to a dataset
pltr dataset upload <dataset-id> path/to/file.csv

# Execute a SQL query
pltr sql execute "SELECT * FROM dataset LIMIT 10"

# Search ontology objects
pltr ontology object search "customer name:John"

Command Reference

Dataset Commands

  • pltr dataset list - List all accessible datasets
  • pltr dataset get <id> - Get dataset details
  • pltr dataset upload <id> <file> - Upload file to dataset
  • pltr dataset download <id> - Download dataset files

Ontology Commands

  • pltr ontology object search <query> - Search for objects
  • pltr ontology object get <id> - Get specific object
  • pltr ontology action execute <action> - Execute ontology action

SQL Commands

  • pltr sql execute <query> - Execute SQL query
  • pltr sql export <query> --output <file> - Export query results

Configuration Commands

  • pltr configure - Set up authentication
  • pltr configure --profile <name> - Configure named profile

Configuration

Configuration files are stored in ~/.pltr/:

  • ~/.pltr/config - Profile configurations
  • Credentials are stored securely in your system keyring

Environment Variables

You can also configure authentication via environment variables:

export FOUNDRY_HOST=https://your-foundry.palantir.com
export FOUNDRY_TOKEN=your-token-here

Development

Prerequisites

  • Python 3.9+
  • uv for dependency management

Setup

# Clone the repository
git clone https://github.com/anjor/pltr-cli.git
cd pltr-cli

# Install dependencies
uv sync

# Run tests
uv run pytest

# Format code
uv run ruff format
uv run ruff check --fix

Project Structure

pltr-cli/
├── src/
│   └── pltr/
│       ├── cli.py           # Main CLI entry point
│       ├── auth/            # Authentication handling
│       ├── commands/        # CLI command implementations
│       ├── services/        # Foundry service wrappers
│       ├── config/          # Configuration management
│       └── utils/           # Utilities and helpers
└── tests/                   # Test suite

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Built on top of the official Palantir Foundry Platform Python SDK.

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

pltr_cli-0.1.1.tar.gz (92.1 kB view details)

Uploaded Source

Built Distribution

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

pltr_cli-0.1.1-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file pltr_cli-0.1.1.tar.gz.

File metadata

  • Download URL: pltr_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 92.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pltr_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 429ce516c8c17e212bc1c2ebb103de6676930e611a0d8c7054664af868214a33
MD5 430e5fc76d62056796ba86dfa78f9be6
BLAKE2b-256 ea661bf5dde831d590ae63247f3c2b01d100840be4deb003ccda8f535d538eae

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.1.1.tar.gz:

Publisher: publish.yml on anjor/pltr-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pltr_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pltr_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for pltr_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 73a2868af666eafbc00e0f178cbbb3847c7ece14b1e3f129ba450543cb12e4fc
MD5 acc06a6de40b4bd48599e09d5e1f7680
BLAKE2b-256 e44e3707d2cc828387bd0914af2042a1d39ed0afa5f1e386266559d83229e96f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.1.1-py3-none-any.whl:

Publisher: publish.yml on anjor/pltr-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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