semvec/pypi-packages huggingface dataset:
powerdrill 0.1.0
SQLAlchemy dialect for PowerDrill
Requires Python: >=3.7

# PowerDrill SQLAlchemy Dialect

SQLAlchemy dialect for PowerDrill AI, enabling natural language queries through SQLAlchemy's ORM interface. This dialect allows you to interact with PowerDrill's AI-powered data analysis capabilities using familiar SQLAlchemy patterns.

## Installation

```bash
pip install powerdrill
```

## Quick Start

```python
from sqlalchemy import create_engine, text, inspect

# Create engine with credentials
engine = create_engine(
    'powerdrill://ai.data.cloud'
    '?api_key=your-api-key'
    '&user_id=your-user-id'
    '&dataset_id=your-dataset-id'
    '&api_version=v1'  # Optional, defaults to v1
)

# Execute natural language queries
with engine.connect() as connection:
    # Natural language query
    result = connection.execute(text("四个直辖市的全称、区号"))
    for row in result:
        print(row)
    
    # List available datasets
    inspector = inspect(engine)
    datasets = inspector.get_schema_names()
    print("Available datasets:", datasets)
```

## Features

- **Natural Language Queries**: Write queries in natural language that get translated to SQL
- **Dataset Management**: List and inspect available datasets
- **Session Management**: Automatic handling of PowerDrill sessions
- **SQLAlchemy Integration**: Seamless integration with SQLAlchemy ORM patterns
- **Streaming Support**: Handle large result sets efficiently

## Connection URL Format

The PowerDrill SQLAlchemy dialect uses the following connection URL format:

```
powerdrill://[host]?api_key=[api_key]&user_id=[user_id]&dataset_id=[dataset_id]&api_version=[version]
```

Parameters:
- `host`: PowerDrill API host (default: ai.data.cloud)
- `api_key`: Your PowerDrill API key
- `user_id`: Your PowerDrill user ID
- `dataset_id`: Target dataset ID
- `api_version`: API version to use (optional, default: v1)

## Requirements

- Python >= 3.7
- SQLAlchemy >= 1.4.0
- requests >= 2.25.0

## API Documentation

For detailed API documentation, visit:
- PowerDrill API Documentation: https://ai.data.cloud/docs
- PowerDrill Developer Guide: https://ai.data.cloud/developer-guides

## License

MIT License

## Support

For support or bug reports, please visit our [GitHub issues page](https://github.com/powerdrill/powerdrill-sqlalchemy/issues) or contact support@powerdrill.ai.