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

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.0.tar.gz (88.4 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.0-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pltr_cli-0.1.0.tar.gz
  • Upload date:
  • Size: 88.4 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.0.tar.gz
Algorithm Hash digest
SHA256 bd3db2b8a5c967880d8d339a360f72e01d234946696411cad4911122e1b08944
MD5 fcee04d1df7e5480c4d81928191c3534
BLAKE2b-256 a0b106a46e73b70dd27bf12dbece8f3a4059120a5cfff17734c860d18bc5bcf1

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: pltr_cli-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa19f8c8f124003fa0f7575f9771b463624e08543990cdff20be5d906e00b7e8
MD5 3d6932f5b63efe64543f643d6fb8a872
BLAKE2b-256 9325dbf60746649861882202a5876290c8748ee56fabe6a8088b88ea8c02597d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pltr_cli-0.1.0-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