Coverage for src/crump/__init__.py: 100%

1"""Sync CSV, Parquet, and CDF science files into database.

2

3 This package provides both a CLI tool and programmatic API for syncing

4 CSV, Parquet, and CDF files into a database (PostgreSQL or SQLite).

5

6 CLI Usage:

7 crump sync <file> <config> <job> --db-url <url>

8 crump prepare <file> <config> <job>

9 crump inspect <file>

10 crump extract <file> --output-dir <dir>

11

12 Programmatic Usage:

13 from crump import sync_file_to_db, analyze_tabular_file_types_and_nullable

14 from pathlib import Path

15

16 # Sync a tabular file (CSV or Parquet)

17 sync_file_to_db(

18 file_path=Path("data.parquet"),

19 job=job_config,

20 db_connection_string="postgresql://localhost/mydb"

21 )

22"""

23

24 __version__ = "0.4.1"

25

26# Export main API functions

27 from crump.config import (

28 ColumnMapping,

29 CrumpConfig,

30 CrumpJob,

31 FailureMode,

32 Index,

33 IndexColumn,

34)

35 from crump.database import (

36 DryRunSummary,

37 sync_file_to_db,

38 sync_file_to_db_dry_run,

39)

40 from crump.type_detection import (

41 analyze_tabular_file_types_and_nullable,

42 suggest_id_column,

43)

44

45 __all__ = [

46 "__version__",

47 # Configuration

48 "CrumpConfig",

49 "CrumpJob",

50 "ColumnMapping",

51 "FailureMode",

52 "Index",

53 "IndexColumn",

54 # Database operations

55 "sync_file_to_db",

56 "sync_file_to_db_dry_run",

57 "DryRunSummary",

58 # Type detection

59 "analyze_tabular_file_types_and_nullable",

60 "suggest_id_column",

61]