kumoai 2.14.0.dev202512181731__cp312-cp312-macosx_11_0_arm64.whl → 2.14.0.dev202601041732__cp312-cp312-macosx_11_0_arm64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. kumoai/__init__.py +23 -26
  2. kumoai/_version.py +1 -1
  3. kumoai/client/client.py +6 -0
  4. kumoai/client/jobs.py +24 -0
  5. kumoai/connector/utils.py +21 -7
  6. kumoai/experimental/rfm/__init__.py +24 -22
  7. kumoai/experimental/rfm/backend/local/graph_store.py +12 -21
  8. kumoai/experimental/rfm/backend/local/sampler.py +0 -3
  9. kumoai/experimental/rfm/backend/local/table.py +25 -24
  10. kumoai/experimental/rfm/backend/snow/sampler.py +106 -61
  11. kumoai/experimental/rfm/backend/snow/table.py +146 -51
  12. kumoai/experimental/rfm/backend/sqlite/sampler.py +127 -78
  13. kumoai/experimental/rfm/backend/sqlite/table.py +94 -47
  14. kumoai/experimental/rfm/base/__init__.py +6 -7
  15. kumoai/experimental/rfm/base/column.py +97 -5
  16. kumoai/experimental/rfm/base/expression.py +44 -0
  17. kumoai/experimental/rfm/base/sampler.py +5 -17
  18. kumoai/experimental/rfm/base/source.py +1 -1
  19. kumoai/experimental/rfm/base/sql_sampler.py +68 -9
  20. kumoai/experimental/rfm/base/table.py +291 -126
  21. kumoai/experimental/rfm/graph.py +139 -86
  22. kumoai/experimental/rfm/infer/__init__.py +6 -4
  23. kumoai/experimental/rfm/infer/dtype.py +6 -1
  24. kumoai/experimental/rfm/infer/multicategorical.py +1 -1
  25. kumoai/experimental/rfm/infer/stype.py +35 -0
  26. kumoai/experimental/rfm/relbench.py +76 -0
  27. kumoai/experimental/rfm/rfm.py +30 -42
  28. kumoai/experimental/rfm/task_table.py +247 -0
  29. kumoai/trainer/distilled_trainer.py +175 -0
  30. kumoai/utils/display.py +51 -0
  31. {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202601041732.dist-info}/METADATA +1 -1
  32. {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202601041732.dist-info}/RECORD +35 -31
  33. kumoai/experimental/rfm/base/column_expression.py +0 -16
  34. kumoai/experimental/rfm/base/sql_table.py +0 -113
  35. {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202601041732.dist-info}/WHEEL +0 -0
  36. {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202601041732.dist-info}/licenses/LICENSE +0 -0
  37. {kumoai-2.14.0.dev202512181731.dist-info → kumoai-2.14.0.dev202601041732.dist-info}/top_level.txt +0 -0
@@ -1,113 +0,0 @@
1
- from abc import abstractmethod
2
- from collections import defaultdict
3
- from collections.abc import Sequence
4
- from functools import cached_property
5
- from typing import Any
6
-
7
- from kumoapi.model_plan import MissingType
8
-
9
- from kumoai.experimental.rfm.base import (
10
- ColumnExpressionType,
11
- SourceForeignKey,
12
- Table,
13
- )
14
- from kumoai.utils import quote_ident
15
-
16
-
17
- class SQLTable(Table):
18
- r"""A :class:`SQLTable` specifies a :class:`Table` backed by a SQL
19
- database.
20
-
21
- Args:
22
- name: The logical name of this table.
23
- source_name: The physical name of this table in the database. If set to
24
- ``None``, ``name`` is being used.
25
- columns: The selected physical columns of this table.
26
- column_expressions: The logical columns of this table.
27
- primary_key: The name of the primary key of this table, if it exists.
28
- time_column: The name of the time column of this table, if it exists.
29
- end_time_column: The name of the end time column of this table, if it
30
- exists.
31
- """
32
- def __init__(
33
- self,
34
- name: str,
35
- source_name: str | None = None,
36
- columns: Sequence[str] | None = None,
37
- column_expressions: Sequence[ColumnExpressionType] | None = None,
38
- primary_key: MissingType | str | None = MissingType.VALUE,
39
- time_column: str | None = None,
40
- end_time_column: str | None = None,
41
- ) -> None:
42
-
43
- self._connection: Any
44
- self._source_name = source_name or name
45
-
46
- super().__init__(
47
- name=name,
48
- columns=[],
49
- primary_key=None,
50
- time_column=None,
51
- end_time_column=None,
52
- )
53
-
54
- if isinstance(primary_key, MissingType):
55
- primary_key = self._source_primary_key
56
-
57
- # Add column expressions with highest priority:
58
- self._add_column_expressions(column_expressions or [])
59
-
60
- if columns is None:
61
- for column_name in self._source_column_dict.keys():
62
- if column_name not in self:
63
- self.add_column(column_name)
64
- else:
65
- for column_name in columns:
66
- self.add_column(column_name)
67
-
68
- if primary_key is not None:
69
- if primary_key not in self:
70
- self.add_column(primary_key)
71
- self.primary_key = primary_key
72
-
73
- if time_column is not None:
74
- if time_column not in self:
75
- self.add_column(time_column)
76
- self.time_column = time_column
77
-
78
- if end_time_column is not None:
79
- if end_time_column not in self:
80
- self.add_column(end_time_column)
81
- self.end_time_column = end_time_column
82
-
83
- @property
84
- def fqn(self) -> str:
85
- r"""The fully-qualified quoted source table name."""
86
- return quote_ident(self._source_name)
87
-
88
- # Column ##################################################################
89
-
90
- def _add_column_expressions(
91
- self,
92
- columns: Sequence[ColumnExpressionType],
93
- ) -> None:
94
- pass
95
-
96
- # Abstract Methods ########################################################
97
-
98
- @cached_property
99
- def _source_foreign_key_dict(self) -> dict[str, SourceForeignKey]:
100
- fkeys = self._get_source_foreign_keys()
101
- # NOTE Drop all keys that link to multiple keys in the same table since
102
- # we don't support composite keys yet:
103
- table_pkeys: dict[str, set[str]] = defaultdict(set)
104
- for fkey in fkeys:
105
- table_pkeys[fkey.dst_table].add(fkey.primary_key)
106
- return {
107
- fkey.name: fkey
108
- for fkey in fkeys if len(table_pkeys[fkey.dst_table]) == 1
109
- }
110
-
111
- @abstractmethod
112
- def _get_source_foreign_keys(self) -> list[SourceForeignKey]:
113
- pass