semvec/pypi-packages huggingface dataset:
sqlalchemy-powerdrill 0.3.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 sqlalchemy-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
- **Dataset Management**: List and explore available datasets
- **SQLAlchemy Integration**: Seamless integration with SQLAlchemy ORM patterns
- **Streaming Support**: Handle large result sets efficiently
- **JSON Response Format**: Structured JSON output for easy data processing

## 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=[api_version]
```

### Connection Parameters

- `host`: The PowerDrill API host
- `api_key`: Your PowerDrill API key
- `user_id`: Your PowerDrill user ID
- `dataset_id`: ID of the dataset to query
- `api_version`: API version to use (optional, defaults to 'v1')

## Requirements

- Python >= 3.7
- SQLAlchemy >= 1.4.0, < 2.0.0
- requests >= 2.31.0

## License

MIT License

## Support

For support or bug reports, please contact dev@powerdrill.ai.