|
| 1 | +"""Stable, database-connected public API.""" |
| 2 | + |
| 3 | +from collections.abc import Mapping |
| 4 | +from pathlib import Path |
| 5 | +from typing import Any |
| 6 | + |
| 7 | +from .core import CapabilityDeclaration |
| 8 | +from .spss import export_dataset, import_dataset, inspect_source |
| 9 | +from .sql import validate_dataset |
| 10 | + |
| 11 | + |
| 12 | +def capabilities() -> Mapping[str, Any]: |
| 13 | + return CapabilityDeclaration.empty().as_dict() |
| 14 | + |
| 15 | + |
| 16 | +def inspect(source: str | Path, /, **options: Any) -> Mapping[str, Any]: |
| 17 | + return inspect_source(source, **options) |
| 18 | + |
| 19 | + |
| 20 | +def import_sav(source: str | Path, /, *, database_url: Any, dataset_id: str, **options: Any) -> Mapping[str, Any]: |
| 21 | + """Import one source file into one dedicated wide SQL table.""" |
| 22 | + return import_dataset(source, database_url=database_url, dataset_id=dataset_id, **options) |
| 23 | + |
| 24 | + |
| 25 | +def export_sav(*, database_url: Any, dataset_id: str, destination: str | Path, **options: Any) -> Mapping[str, Any]: |
| 26 | + """Export one database-resident conforming dataset to SAV/ZSAV.""" |
| 27 | + return export_dataset(database_url=database_url, dataset_id=dataset_id, destination=destination, **options) |
| 28 | + |
| 29 | + |
| 30 | +def validate(*, database_url: Any, dataset_id: str, **options: Any) -> Mapping[str, Any]: |
| 31 | + return validate_dataset(database_url=database_url, dataset_id=dataset_id, **options) |
0 commit comments