# pydataframer-databricks

Databricks connector for Dataframer

## Installation

```bash
pip install pydataframer-databricks
```

## Usage

```python
from pydataframer_databricks import DatabricksConnector, DatasetType, FileType

databricks_connector = DatabricksConnector(dbutils, scope="dataframer")
```

### Fetch sample data

```python
df = databricks_connector.fetch_sample_data(
    num_items_to_select=100,
    table_name="catalog.schema.table"
)
```

### Load to table (SINGLE_FILE: CSV, JSON, JSONL)

```python
databricks_connector.load_to_table(
    table_name="catalog.schema.generated_samples",
    downloaded_zip=downloaded_zip,
    dataset_type=DatasetType.SINGLE_FILE,
    file_type=FileType.CSV,  # or FileType.JSON, FileType.JSONL
)
```

### Load to volume (any dataset type)

```python
databricks_connector.load_to_volume(
    volume_path="/Volumes/catalog/schema/volume_name",
    downloaded_zip=downloaded_zip,
    output_folder="generated_samples",  # optional
)
```
