Metadata-Version: 2.4
Name: ds-provider-aic-py-lib
Version: 0.1.0a1
Summary: DS package for ds-provider-aic-py-lib
Author-email: Kristopy <hello@grasplabs.com>
Maintainer-email: Kristopy <hello@grasplabs.com>
License-Expression: Apache-2.0
Project-URL: Documentation, https://grasp-labs.github.io/ds-provider-aic-py-lib/
Project-URL: Repository, https://github.com/grasp-labs/ds-provider-aic-py-lib/
Project-URL: Issues, https://github.com/grasp-labs/ds-provider-aic-py-lib/issues/
Project-URL: Changelog, https://github.com/grasp-labs/ds-provider-aic-py-lib/releases
Keywords: ds,python,aic,fetch,gold
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE-APACHE
Requires-Dist: ds-resource-plugin-py-lib<1.0.0,>=0.1.2
Requires-Dist: ds-common-logger-py-lib<1.0.0,>=0.1.0a6
Requires-Dist: ds-common-serde-py-lib<1.0.0,>=0.1.0b1
Requires-Dist: ds-protocol-http-py-lib<1.0.0,>=0.1.0
Requires-Dist: pandas<3.0.0,>=2.2.0
Requires-Dist: pyarrow<22.0.0,>=15.0.0
Provides-Extra: dev
Requires-Dist: ruff>=0.1.8; extra == "dev"
Requires-Dist: mypy>=1.7.0; extra == "dev"
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.3.0; extra == "dev"
Requires-Dist: pre-commit>=3.6.0; extra == "dev"
Requires-Dist: build>=1.0.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Requires-Dist: sphinx>=7.1.0; extra == "dev"
Requires-Dist: sphinx-autoapi>=3.0.0; extra == "dev"
Requires-Dist: sphinx-material>=0.0.35; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: pandas-stubs>=2.2.0; extra == "dev"
Requires-Dist: python-dotenv>=1.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.4.0; extra == "test"
Requires-Dist: pytest-cov>=4.1.0; extra == "test"
Requires-Dist: pytest-xdist>=3.3.0; extra == "test"
Provides-Extra: docs
Requires-Dist: sphinx>=7.1.0; extra == "docs"
Requires-Dist: sphinx-autoapi>=3.0.0; extra == "docs"
Requires-Dist: sphinx-material>=0.0.35; extra == "docs"
Dynamic: license-file

# ds-provider-aic-py-lib

DS package for ds-provider-aic-py-lib

## Installation

Install the package using pip:

```bash
pip install ds-provider-aic-py-lib
```

Or using uv (recommended):

```bash
uv pip install ds-provider-aic-py-lib
```

## Quick Start

```python
from uuid import uuid4

from ds_protocol_http_py_lib.enums import AuthType

from ds_provider_aic_py_lib.dataset.gold import (
    AICGoldDataset,
    AICGoldDatasetSettings,
    GoldReadSettings,
)
from ds_provider_aic_py_lib.enums import HistoryMode, PublishMode
from ds_provider_aic_py_lib.linked_service.identity import (
    AICIdentityLinkedService,
    AICIdentityLinkedServiceSettings,
    AICIdentityOAuth2AuthSettings,
)

linked_service = AICIdentityLinkedService(
    id=uuid4(),
    name="aic-identity",
    version="v1.0.0",
    settings=AICIdentityLinkedServiceSettings(
        auth_type=AuthType.OAUTH2,
        oauth2=AICIdentityOAuth2AuthSettings(
            client_id="client",
            client_secret="secret",
        ),
    ),
)
dataset = AICGoldDataset(
    id=uuid4(),
    name="employees",
    version="v1.0.0",
    linked_service=linked_service,
    settings=AICGoldDatasetSettings(
        publish_mode=PublishMode.UPSERT,
        primary_key_fields=["employee_id"],
        history_mode=HistoryMode.SCD2,
        partition_keys=[],
        read=GoldReadSettings(sql="SELECT count(*) AS n FROM gold"),
    ),
)
linked_service.connect()
dataset.read()
dataset.output
```

## Features

- Identity linked service with OAuth2 client credentials and
  username/password login
- Read-only gold dataset over the fetch API
- SQL is required. Name this dataset `gold`. That name is rewritten to
  this dataset id. A quoted reference to another dataset is rejected
  here. Fetch grants decide any other name
- A resumed `read()` returns only the pages from the saved offset. The
  caller keeps earlier pages and the same SQL in settings
- A result that spans more than one page needs `ORDER BY`. Without it,
  later pages can skip or repeat rows, and `read()` logs a warning
- `read()` deserializes each query page with `FetchQueryDeserializer`

## Usage

Gold mutation is not supported. `create`, `update`, `upsert`, `delete`,
`purge`, and `rename` raise `NotSupportedError`.

The repository `examples/` scripts read credentials from `.env`.
They are not installed with the package.

## Requirements

- Python 3.11 or higher
- `ds-resource-plugin-py-lib`
- `ds-protocol-http-py-lib`
- `ds-common-serde-py-lib`
- `pandas`
- `pyarrow`

## Optional Dependencies

- `dev`: lint, types, tests, docs, and `python-dotenv` for the examples
- `test`: pytest
- `docs`: Sphinx

## Documentation

Full documentation is available at:

- [GitHub Repository](https://github.com/grasp-labs/ds-provider-aic-py-lib)
- [Documentation Site](https://grasp-labs.github.io/ds-provider-aic-py-lib/)

## Development

To contribute or set up a development environment:

```bash
# Clone the repository
git clone https://github.com/grasp-labs/ds-provider-aic-py-lib.git
cd ds-provider-aic-py-lib

# Install development dependencies
uv sync --all-extras --dev

# Run tests
make test
```

See the [README](https://github.com/grasp-labs/ds-provider-aic-py-lib#readme)
for more information.

## License

This package is licensed under the Apache License 2.0.
See the [LICENSE-APACHE](https://github.com/grasp-labs/ds-provider-aic-py-lib/blob/main/LICENSE-APACHE)
file for details.

## Support

- **Issues**: [GitHub Issues](https://github.com/grasp-labs/ds-provider-aic-py-lib/issues)
- **Releases**: [GitHub Releases](https://github.com/grasp-labs/ds-provider-aic-py-lib/releases)
