PIPolars 0.1.0 documentation

Skip to content
Back to top
View this page
Edit this page

# PIPolars Documentation

High-performance PI System data extraction library with Polars DataFrames

PIPolars is a modern Python library for extracting data from OSIsoft PI System and converting it to Polars DataFrames for efficient data science workflows.

Note

PIPolars requires Windows with the OSIsoft PI AF SDK installed. See Installation for detailed requirements.

## Features

- Polars DataFrames: 10-100x faster than pandas for many operations

- Modern Python: Full type hints, Pydantic configuration, Python 3.10+

- Efficient Bulk Operations: Native bulk API support for extracting multiple tags

- Lazy Evaluation: Polars LazyFrame support for query optimization

- Caching: SQLite and Arrow IPC caching for reduced server load

- Fluent Query API: Method chaining for readable, declarative queries

- uv Compatible: Modern package management with Astral’s uv

## Quick Example

    from pipolars import PIClient

    # Connect to PI Server and get data as Polars DataFrame
    with PIClient("my-pi-server") as client:
        # Get last 24 hours of data
        df = client.recorded_values("SINUSOID", start="*-1d", end="*")
        print(f"Retrieved {len(df)} values")

        # Use fluent query builder
        df = (
            client.query(["TAG1", "TAG2"])
            .last(hours=4)
            .interpolated(interval="15m")
            .pivot()
            .to_dataframe()
        )

Getting Started

- Installation
  - Requirements
  - Installing the PI AF SDK
  - Installing PIPolars
  - Verifying the Installation
  - Troubleshooting
  - Optional Dependencies
  - Environment Variables
  - Next Steps
- Quickstart
  - Basic Connection
  - Retrieving Historical Data
  - Working with Multiple Tags
  - Using the Query Builder
  - Summary Statistics
  - Convenience Methods
  - Time Expressions
  - Data Processing with Polars
  - Searching for Tags
  - Next Steps

User Guide

- User Guide
  - Overview
  - Typical Workflow
  - Guide Contents
- Connecting to PI Server
  - Basic Connection
  - Manual Connection Management
  - Connection Properties
  - Server Configuration
  - Authentication
  - Using Environment Variables
  - Discovering Servers
  - Low-Level Connection
  - Connection Pooling
  - Error Handling
  - Next Steps
- Querying Data
  - Query Methods Overview
  - Direct Methods
  - Query Builder (Fluent API)
  - Convenience Methods
  - Tag Operations
  - Output Format Options
  - Next Steps
- Time Expressions
  - PI Time Expression Syntax
  - Using Time Expressions
  - The AFTime Class
  - Python datetime Objects
  - TimeRange Class
  - Interval Specifications
  - Best Practices
  - Error Handling
  - Next Steps
- Working with Polars DataFrames
  - Why Polars?
  - DataFrame Structure
  - Basic Operations
  - Transformations
  - Common Data Science Patterns
  - LazyFrame for Large Data
  - Converting to Other Formats
  - Performance Tips
  - Next Steps
- Caching
  - Overview
  - Enabling Caching
  - Cache Backends
  - Cache Management
  - Cache Key Generation
  - Environment Variables
  - Best Practices
  - Advanced: Custom Cache Backend
  - Troubleshooting
  - Next Steps
- Configuration
  - Configuration Classes
  - PIConfig
  - PIServerConfig
  - AFServerConfig
  - CacheConfig
  - QueryConfig
  - PolarsConfig
  - Configuration Files
  - Environment File (.env)
  - Configuration Precedence
  - Viewing Configuration
  - Validation
  - Complete Example
  - Next Steps
- Advanced Usage
  - Bulk Operations
  - Lazy Evaluation
  - Error Handling
  - Streaming Large Datasets
  - Custom Data Processing Pipeline
  - Logging and Monitoring
  - Connection Pooling Pattern
  - Working with AF Data
  - uv Script Dependencies
  - Integration with Other Libraries
  - Next Steps

API Reference

- API Reference
  - Overview
  - Quick Reference
  - Detailed API
- PIClient
  - PIClient Class
  - Usage Examples
  - See Also
- PIQuery
  - PIQuery Class
  - QueryOptions Class
  - QueryType Enum
  - Usage Examples
  - See Also
- Types
  - Type Aliases
  - AFTime Class
  - PIValue Class
  - TimeRange Class
  - PointConfig Class
  - SummaryResult Class
  - Enumerations
  - Schema Definitions
  - See Also
- Configuration
  - PIConfig
  - PIServerConfig
  - AFServerConfig
  - CacheConfig
  - QueryConfig
  - PolarsConfig
  - Enumerations
  - Configuration File Format
  - See Also
- Exceptions
  - Exception Hierarchy
  - Base Exception
  - Connection Exceptions
  - Data Exceptions
  - Query Exceptions
  - Other Exceptions
  - Error Handling Patterns
  - See Also
- Cache
  - Storage Module
  - Strategies Module
  - Cache Key Generation
  - Cache Statistics
  - Integration with PIClient
  - Custom Cache Backend
  - See Also

Additional Information

- Changelog
- Contributing
- License

# Indices and tables

- Index

- Module Index

- Search Page