chalkpy 2.90.1__py3-none-any.whl → 2.95.3__py3-none-any.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 (202) hide show
  1. chalk/__init__.py +2 -1
  2. chalk/_gen/chalk/arrow/v1/arrow_pb2.py +7 -5
  3. chalk/_gen/chalk/arrow/v1/arrow_pb2.pyi +6 -0
  4. chalk/_gen/chalk/artifacts/v1/chart_pb2.py +16 -16
  5. chalk/_gen/chalk/artifacts/v1/chart_pb2.pyi +4 -0
  6. chalk/_gen/chalk/artifacts/v1/cron_query_pb2.py +8 -7
  7. chalk/_gen/chalk/artifacts/v1/cron_query_pb2.pyi +5 -0
  8. chalk/_gen/chalk/common/v1/offline_query_pb2.py +17 -15
  9. chalk/_gen/chalk/common/v1/offline_query_pb2.pyi +25 -0
  10. chalk/_gen/chalk/common/v1/script_task_pb2.py +3 -3
  11. chalk/_gen/chalk/common/v1/script_task_pb2.pyi +2 -0
  12. chalk/_gen/chalk/dataframe/__init__.py +0 -0
  13. chalk/_gen/chalk/dataframe/v1/__init__.py +0 -0
  14. chalk/_gen/chalk/dataframe/v1/dataframe_pb2.py +48 -0
  15. chalk/_gen/chalk/dataframe/v1/dataframe_pb2.pyi +123 -0
  16. chalk/_gen/chalk/dataframe/v1/dataframe_pb2_grpc.py +4 -0
  17. chalk/_gen/chalk/dataframe/v1/dataframe_pb2_grpc.pyi +4 -0
  18. chalk/_gen/chalk/graph/v1/graph_pb2.py +150 -149
  19. chalk/_gen/chalk/graph/v1/graph_pb2.pyi +25 -0
  20. chalk/_gen/chalk/graph/v1/sources_pb2.py +94 -84
  21. chalk/_gen/chalk/graph/v1/sources_pb2.pyi +56 -0
  22. chalk/_gen/chalk/kubernetes/v1/horizontalpodautoscaler_pb2.py +79 -0
  23. chalk/_gen/chalk/kubernetes/v1/horizontalpodautoscaler_pb2.pyi +377 -0
  24. chalk/_gen/chalk/kubernetes/v1/horizontalpodautoscaler_pb2_grpc.py +4 -0
  25. chalk/_gen/chalk/kubernetes/v1/horizontalpodautoscaler_pb2_grpc.pyi +4 -0
  26. chalk/_gen/chalk/kubernetes/v1/scaledobject_pb2.py +43 -7
  27. chalk/_gen/chalk/kubernetes/v1/scaledobject_pb2.pyi +252 -2
  28. chalk/_gen/chalk/protosql/v1/sql_service_pb2.py +54 -27
  29. chalk/_gen/chalk/protosql/v1/sql_service_pb2.pyi +131 -3
  30. chalk/_gen/chalk/protosql/v1/sql_service_pb2_grpc.py +45 -0
  31. chalk/_gen/chalk/protosql/v1/sql_service_pb2_grpc.pyi +14 -0
  32. chalk/_gen/chalk/python/v1/types_pb2.py +14 -14
  33. chalk/_gen/chalk/python/v1/types_pb2.pyi +8 -0
  34. chalk/_gen/chalk/server/v1/benchmark_pb2.py +76 -0
  35. chalk/_gen/chalk/server/v1/benchmark_pb2.pyi +156 -0
  36. chalk/_gen/chalk/server/v1/benchmark_pb2_grpc.py +258 -0
  37. chalk/_gen/chalk/server/v1/benchmark_pb2_grpc.pyi +84 -0
  38. chalk/_gen/chalk/server/v1/billing_pb2.py +40 -38
  39. chalk/_gen/chalk/server/v1/billing_pb2.pyi +17 -1
  40. chalk/_gen/chalk/server/v1/branches_pb2.py +45 -0
  41. chalk/_gen/chalk/server/v1/branches_pb2.pyi +80 -0
  42. chalk/_gen/chalk/server/v1/branches_pb2_grpc.pyi +36 -0
  43. chalk/_gen/chalk/server/v1/builder_pb2.py +358 -288
  44. chalk/_gen/chalk/server/v1/builder_pb2.pyi +360 -10
  45. chalk/_gen/chalk/server/v1/builder_pb2_grpc.py +225 -0
  46. chalk/_gen/chalk/server/v1/builder_pb2_grpc.pyi +60 -0
  47. chalk/_gen/chalk/server/v1/chart_pb2.py +10 -10
  48. chalk/_gen/chalk/server/v1/chart_pb2.pyi +18 -2
  49. chalk/_gen/chalk/server/v1/clickhouse_pb2.py +42 -0
  50. chalk/_gen/chalk/server/v1/clickhouse_pb2.pyi +17 -0
  51. chalk/_gen/chalk/server/v1/clickhouse_pb2_grpc.py +78 -0
  52. chalk/_gen/chalk/server/v1/clickhouse_pb2_grpc.pyi +38 -0
  53. chalk/_gen/chalk/server/v1/cloud_components_pb2.py +141 -119
  54. chalk/_gen/chalk/server/v1/cloud_components_pb2.pyi +106 -4
  55. chalk/_gen/chalk/server/v1/cloud_components_pb2_grpc.py +45 -0
  56. chalk/_gen/chalk/server/v1/cloud_components_pb2_grpc.pyi +12 -0
  57. chalk/_gen/chalk/server/v1/cloud_credentials_pb2.py +11 -3
  58. chalk/_gen/chalk/server/v1/cloud_credentials_pb2.pyi +20 -0
  59. chalk/_gen/chalk/server/v1/cloud_credentials_pb2_grpc.py +45 -0
  60. chalk/_gen/chalk/server/v1/cloud_credentials_pb2_grpc.pyi +12 -0
  61. chalk/_gen/chalk/server/v1/dataplanejobqueue_pb2.py +52 -38
  62. chalk/_gen/chalk/server/v1/dataplanejobqueue_pb2.pyi +62 -1
  63. chalk/_gen/chalk/server/v1/dataplanejobqueue_pb2_grpc.py +90 -0
  64. chalk/_gen/chalk/server/v1/dataplanejobqueue_pb2_grpc.pyi +24 -0
  65. chalk/_gen/chalk/server/v1/dataplaneworkflows_pb2.py +90 -0
  66. chalk/_gen/chalk/server/v1/dataplaneworkflows_pb2.pyi +264 -0
  67. chalk/_gen/chalk/server/v1/dataplaneworkflows_pb2_grpc.py +170 -0
  68. chalk/_gen/chalk/server/v1/dataplaneworkflows_pb2_grpc.pyi +62 -0
  69. chalk/_gen/chalk/server/v1/deploy_pb2.py +9 -3
  70. chalk/_gen/chalk/server/v1/deploy_pb2.pyi +12 -0
  71. chalk/_gen/chalk/server/v1/deploy_pb2_grpc.py +45 -0
  72. chalk/_gen/chalk/server/v1/deploy_pb2_grpc.pyi +12 -0
  73. chalk/_gen/chalk/server/v1/deployment_pb2.py +6 -6
  74. chalk/_gen/chalk/server/v1/deployment_pb2.pyi +20 -0
  75. chalk/_gen/chalk/server/v1/environment_pb2.py +14 -12
  76. chalk/_gen/chalk/server/v1/environment_pb2.pyi +19 -0
  77. chalk/_gen/chalk/server/v1/eventbus_pb2.py +4 -2
  78. chalk/_gen/chalk/server/v1/files_pb2.py +65 -0
  79. chalk/_gen/chalk/server/v1/files_pb2.pyi +167 -0
  80. chalk/_gen/chalk/server/v1/files_pb2_grpc.py +4 -0
  81. chalk/_gen/chalk/server/v1/files_pb2_grpc.pyi +4 -0
  82. chalk/_gen/chalk/server/v1/graph_pb2.py +38 -26
  83. chalk/_gen/chalk/server/v1/graph_pb2.pyi +58 -0
  84. chalk/_gen/chalk/server/v1/graph_pb2_grpc.py +47 -0
  85. chalk/_gen/chalk/server/v1/graph_pb2_grpc.pyi +18 -0
  86. chalk/_gen/chalk/server/v1/incident_pb2.py +23 -21
  87. chalk/_gen/chalk/server/v1/incident_pb2.pyi +15 -1
  88. chalk/_gen/chalk/server/v1/indexing_job_pb2.py +44 -0
  89. chalk/_gen/chalk/server/v1/indexing_job_pb2.pyi +38 -0
  90. chalk/_gen/chalk/server/v1/indexing_job_pb2_grpc.py +78 -0
  91. chalk/_gen/chalk/server/v1/indexing_job_pb2_grpc.pyi +38 -0
  92. chalk/_gen/chalk/server/v1/integrations_pb2.py +11 -9
  93. chalk/_gen/chalk/server/v1/integrations_pb2.pyi +34 -2
  94. chalk/_gen/chalk/server/v1/kube_pb2.py +29 -19
  95. chalk/_gen/chalk/server/v1/kube_pb2.pyi +28 -0
  96. chalk/_gen/chalk/server/v1/kube_pb2_grpc.py +45 -0
  97. chalk/_gen/chalk/server/v1/kube_pb2_grpc.pyi +12 -0
  98. chalk/_gen/chalk/server/v1/log_pb2.py +21 -3
  99. chalk/_gen/chalk/server/v1/log_pb2.pyi +68 -0
  100. chalk/_gen/chalk/server/v1/log_pb2_grpc.py +90 -0
  101. chalk/_gen/chalk/server/v1/log_pb2_grpc.pyi +24 -0
  102. chalk/_gen/chalk/server/v1/model_registry_pb2.py +10 -10
  103. chalk/_gen/chalk/server/v1/model_registry_pb2.pyi +4 -1
  104. chalk/_gen/chalk/server/v1/plandebug_pb2.py +53 -0
  105. chalk/_gen/chalk/server/v1/plandebug_pb2.pyi +86 -0
  106. chalk/_gen/chalk/server/v1/plandebug_pb2_grpc.py +168 -0
  107. chalk/_gen/chalk/server/v1/plandebug_pb2_grpc.pyi +60 -0
  108. chalk/_gen/chalk/server/v1/queries_pb2.py +66 -66
  109. chalk/_gen/chalk/server/v1/queries_pb2.pyi +32 -2
  110. chalk/_gen/chalk/server/v1/scheduled_query_run_pb2.py +12 -12
  111. chalk/_gen/chalk/server/v1/scheduled_query_run_pb2.pyi +16 -3
  112. chalk/_gen/chalk/server/v1/scheduler_pb2.py +24 -12
  113. chalk/_gen/chalk/server/v1/scheduler_pb2.pyi +61 -1
  114. chalk/_gen/chalk/server/v1/scheduler_pb2_grpc.py +90 -0
  115. chalk/_gen/chalk/server/v1/scheduler_pb2_grpc.pyi +24 -0
  116. chalk/_gen/chalk/server/v1/script_tasks_pb2.py +15 -3
  117. chalk/_gen/chalk/server/v1/script_tasks_pb2.pyi +22 -0
  118. chalk/_gen/chalk/server/v1/script_tasks_pb2_grpc.py +90 -0
  119. chalk/_gen/chalk/server/v1/script_tasks_pb2_grpc.pyi +24 -0
  120. chalk/_gen/chalk/server/v1/sql_interface_pb2.py +75 -0
  121. chalk/_gen/chalk/server/v1/sql_interface_pb2.pyi +142 -0
  122. chalk/_gen/chalk/server/v1/sql_interface_pb2_grpc.py +349 -0
  123. chalk/_gen/chalk/server/v1/sql_interface_pb2_grpc.pyi +114 -0
  124. chalk/_gen/chalk/server/v1/sql_queries_pb2.py +48 -0
  125. chalk/_gen/chalk/server/v1/sql_queries_pb2.pyi +150 -0
  126. chalk/_gen/chalk/server/v1/sql_queries_pb2_grpc.py +123 -0
  127. chalk/_gen/chalk/server/v1/sql_queries_pb2_grpc.pyi +52 -0
  128. chalk/_gen/chalk/server/v1/team_pb2.py +154 -141
  129. chalk/_gen/chalk/server/v1/team_pb2.pyi +30 -2
  130. chalk/_gen/chalk/server/v1/team_pb2_grpc.py +45 -0
  131. chalk/_gen/chalk/server/v1/team_pb2_grpc.pyi +12 -0
  132. chalk/_gen/chalk/server/v1/topic_pb2.py +5 -3
  133. chalk/_gen/chalk/server/v1/topic_pb2.pyi +10 -1
  134. chalk/_gen/chalk/server/v1/trace_pb2.py +44 -40
  135. chalk/_gen/chalk/server/v1/trace_pb2.pyi +20 -0
  136. chalk/_gen/chalk/streaming/v1/debug_service_pb2.py +62 -0
  137. chalk/_gen/chalk/streaming/v1/debug_service_pb2.pyi +75 -0
  138. chalk/_gen/chalk/streaming/v1/debug_service_pb2_grpc.py +221 -0
  139. chalk/_gen/chalk/streaming/v1/debug_service_pb2_grpc.pyi +88 -0
  140. chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.py +16 -10
  141. chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2.pyi +52 -1
  142. chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.py +48 -0
  143. chalk/_gen/chalk/streaming/v1/simple_streaming_service_pb2_grpc.pyi +20 -0
  144. chalk/_gen/chalk/utils/v1/field_change_pb2.py +32 -0
  145. chalk/_gen/chalk/utils/v1/field_change_pb2.pyi +42 -0
  146. chalk/_gen/chalk/utils/v1/field_change_pb2_grpc.py +4 -0
  147. chalk/_gen/chalk/utils/v1/field_change_pb2_grpc.pyi +4 -0
  148. chalk/_lsp/error_builder.py +11 -0
  149. chalk/_version.py +1 -1
  150. chalk/client/client.py +128 -43
  151. chalk/client/client_async.py +149 -0
  152. chalk/client/client_async_impl.py +22 -0
  153. chalk/client/client_grpc.py +539 -104
  154. chalk/client/client_impl.py +449 -122
  155. chalk/client/dataset.py +7 -1
  156. chalk/client/models.py +98 -0
  157. chalk/client/serialization/model_serialization.py +92 -9
  158. chalk/df/LazyFramePlaceholder.py +1154 -0
  159. chalk/features/_class_property.py +7 -0
  160. chalk/features/_embedding/embedding.py +1 -0
  161. chalk/features/_encoding/converter.py +83 -2
  162. chalk/features/feature_field.py +40 -30
  163. chalk/features/feature_set_decorator.py +1 -0
  164. chalk/features/feature_wrapper.py +42 -3
  165. chalk/features/hooks.py +81 -10
  166. chalk/features/inference.py +33 -31
  167. chalk/features/resolver.py +224 -24
  168. chalk/functions/__init__.py +65 -3
  169. chalk/gitignore/gitignore_parser.py +5 -1
  170. chalk/importer.py +142 -68
  171. chalk/ml/__init__.py +2 -0
  172. chalk/ml/model_hooks.py +194 -26
  173. chalk/ml/model_reference.py +56 -8
  174. chalk/ml/model_version.py +24 -15
  175. chalk/ml/utils.py +20 -17
  176. chalk/operators/_utils.py +10 -3
  177. chalk/parsed/_proto/export.py +22 -0
  178. chalk/parsed/duplicate_input_gql.py +3 -0
  179. chalk/parsed/json_conversions.py +20 -14
  180. chalk/parsed/to_proto.py +16 -4
  181. chalk/parsed/user_types_to_json.py +31 -10
  182. chalk/parsed/validation_from_registries.py +182 -0
  183. chalk/queries/named_query.py +16 -6
  184. chalk/queries/scheduled_query.py +9 -1
  185. chalk/serialization/parsed_annotation.py +24 -11
  186. chalk/sql/__init__.py +18 -0
  187. chalk/sql/_internal/integrations/databricks.py +55 -17
  188. chalk/sql/_internal/integrations/mssql.py +127 -62
  189. chalk/sql/_internal/integrations/redshift.py +4 -0
  190. chalk/sql/_internal/sql_file_resolver.py +53 -9
  191. chalk/sql/_internal/sql_source.py +35 -2
  192. chalk/streams/_kafka_source.py +5 -1
  193. chalk/streams/_windows.py +15 -2
  194. chalk/utils/_otel_version.py +13 -0
  195. chalk/utils/async_helpers.py +2 -2
  196. chalk/utils/missing_dependency.py +5 -4
  197. chalk/utils/tracing.py +185 -95
  198. {chalkpy-2.90.1.dist-info → chalkpy-2.95.3.dist-info}/METADATA +4 -6
  199. {chalkpy-2.90.1.dist-info → chalkpy-2.95.3.dist-info}/RECORD +202 -146
  200. {chalkpy-2.90.1.dist-info → chalkpy-2.95.3.dist-info}/WHEEL +0 -0
  201. {chalkpy-2.90.1.dist-info → chalkpy-2.95.3.dist-info}/entry_points.txt +0 -0
  202. {chalkpy-2.90.1.dist-info → chalkpy-2.95.3.dist-info}/top_level.txt +0 -0
chalk/client/client.py CHANGED
@@ -32,6 +32,7 @@ from chalk.client.models import (
32
32
  GetIncrementalProgressResponse,
33
33
  GetRegisteredModelResponse,
34
34
  GetRegisteredModelVersionResponse,
35
+ ManualTriggerScheduledQueryResponse,
35
36
  OfflineQueryInputUri,
36
37
  OnlineQuery,
37
38
  OnlineQueryContext,
@@ -40,6 +41,7 @@ from chalk.client.models import (
40
41
  RegisterModelVersionResponse,
41
42
  ResolverRunResponse,
42
43
  ResourceRequests,
44
+ ScheduledQueryRun,
43
45
  StreamResolverTestResponse,
44
46
  WhoAmIResponse,
45
47
  )
@@ -924,6 +926,8 @@ class ChalkClient:
924
926
  max_retries: int | None = None,
925
927
  query_name: str | None = None,
926
928
  query_name_version: str | None = None,
929
+ *,
930
+ input_sql: str | None = None,
927
931
  ) -> Dataset:
928
932
  """Compute feature values from the offline store or by running offline/online resolvers.
929
933
  See `Dataset` for more information.
@@ -944,6 +948,9 @@ class ChalkClient:
944
948
  times, the list must match the length of the `input` lists. Each element of input_time corresponds with the
945
949
  feature values at the same index of the `input` lists.
946
950
  See https://docs.chalk.ai/docs/temporal-consistency for more information.
951
+ input_sql
952
+ An alternative to `input`: a ChalkSQL query that returns values
953
+ to use as inputs.
947
954
  output
948
955
  The features that you'd like to sample, if they exist.
949
956
  If an output feature was never computed for a sample (row) in
@@ -1080,6 +1087,82 @@ class ChalkClient:
1080
1087
  """
1081
1088
  ...
1082
1089
 
1090
+ def run_scheduled_query(
1091
+ self,
1092
+ name: str,
1093
+ planner_options: Optional[Mapping[str, Any]],
1094
+ incremental_resolvers: Optional[Sequence[str]],
1095
+ max_samples: Optional[int],
1096
+ env_overrides: Optional[Mapping[str, str]],
1097
+ ) -> ManualTriggerScheduledQueryResponse:
1098
+ """
1099
+ Manually trigger a scheduled query request.
1100
+
1101
+ Parameters
1102
+ ----------
1103
+ name
1104
+ The name of the scheduled query to be triggered.
1105
+ incremental_resolvers
1106
+ If set to None, Chalk will incrementalize resolvers in the query's root namespaces.
1107
+ If set to a list of resolvers, this set will be used for incrementalization.
1108
+ Incremental resolvers must return a feature time in its output, and must return a `DataFrame`.
1109
+ Most commonly, this will be the name of a SQL file resolver. Chalk will ingest all new data
1110
+ from these resolvers and propagate changes to values in the root namespace.
1111
+ max_samples
1112
+ The maximum number of samples to compute.
1113
+ env_overrides:
1114
+ A dictionary of environment values to override during this specific triggered query.
1115
+
1116
+ Other Parameters
1117
+ ----------------
1118
+ planner_options
1119
+ A dictionary of options to pass to the planner.
1120
+ These are typically provided by Chalk Support for specific use cases.
1121
+
1122
+ Returns
1123
+ -------
1124
+ ManualTriggerScheduledQueryResponse
1125
+ A response message containing metadata around the triggered run.
1126
+
1127
+ Examples
1128
+ --------
1129
+ >>> from chalk.client.client_grpc import ChalkGRPCClient
1130
+ >>> ChalkGRPCClient().run_scheduled_query(
1131
+ ... name="my_scheduled_query",
1132
+ ... )
1133
+ """
1134
+ ...
1135
+
1136
+ def get_scheduled_query_run_history(
1137
+ self,
1138
+ name: str,
1139
+ limit: int = 10,
1140
+ ) -> List[ScheduledQueryRun]:
1141
+ """
1142
+ Get the run history for a scheduled query.
1143
+
1144
+ Parameters
1145
+ ----------
1146
+ name
1147
+ The name of the scheduled query.
1148
+ limit
1149
+ The maximum number of runs to return. Defaults to 10.
1150
+
1151
+ Returns
1152
+ -------
1153
+ list[ScheduledQueryRun]
1154
+ A response message containing the list of scheduled query runs.
1155
+
1156
+ Examples
1157
+ --------
1158
+ >>> from chalk.client import ChalkClient
1159
+ >>> ChalkClient().get_scheduled_query_run_history(
1160
+ ... name="my_scheduled_query",
1161
+ ... limit=20,
1162
+ ... )
1163
+ """
1164
+ ...
1165
+
1083
1166
  def prompt_evaluation(
1084
1167
  self,
1085
1168
  prompts: list[Prompt | str],
@@ -2074,21 +2157,20 @@ class ChalkClient:
2074
2157
  name: str,
2075
2158
  version: Optional[int] = None,
2076
2159
  ) -> Union[GetRegisteredModelResponse, GetRegisteredModelVersionResponse]:
2077
- """
2078
- Retrieve a registered model from the Chalk model registry.
2160
+ """Retrieve a registered model from the Chalk model registry.
2079
2161
 
2080
2162
  Parameters
2081
2163
  ----------
2082
- name : str
2083
- Name of the model to retrieve
2084
- version : int, optional
2085
- Specific version number to retrieve. If not provided, returns
2086
- information about all versions of the model
2164
+ name
2165
+ Name of the model to retrieve.
2166
+ version
2167
+ Specific version number to retrieve. If not provided, returns
2168
+ information about all versions of the model.
2087
2169
 
2088
2170
  Returns
2089
2171
  -------
2090
- GetRegisteredModelResponse or GetRegisteredModelVersionResponse
2091
- Model information including metadata, versions, and configuration details
2172
+ Union[GetRegisteredModelResponse, GetRegisteredModelVersionResponse]
2173
+ Model information including metadata, versions, and configuration details.
2092
2174
 
2093
2175
  Examples
2094
2176
  --------
@@ -2165,49 +2247,49 @@ class ChalkClient:
2165
2247
  source_config: Optional[SourceConfig] = None,
2166
2248
  dependencies: Optional[List[str]] = None,
2167
2249
  ) -> RegisterModelVersionResponse:
2168
- """
2169
- Register a model in the Chalk model registry.
2250
+ """Register a model in the Chalk model registry.
2170
2251
 
2171
2252
  Parameters
2172
2253
  ----------
2173
- name : str
2174
- Unique name for the model
2175
- aliases : list of str, optional
2176
- List of version aliases (e.g., ["v1.0", "latest"])
2177
- model : object, optional
2178
- Python model object (for object-based registration)
2179
- model_paths : list of str, optional
2180
- Paths to model files (for file-based registration)
2181
- additional_files : List[str], optional
2182
- Additional files needed for inference (tokenizers, configs, etc.)
2183
- model_type : ModelType, optional
2184
- Type of model framework
2185
- model_encoding : ModelEncoding, optional
2186
- Serialization format
2187
- input_schema : dict, list, or Any
2188
- Definition of the input schema. Can be:
2189
- - dict: Dictionary mapping column names to dtypes for tabular data
2190
- - list: List of (shape, dtype) tuples for tensor data
2191
- output_schema : dict, list, or Any
2192
- Definition of the output schema. Can be:
2193
- - dict: Dictionary mapping column names to dtypes for tabular data
2194
- - list: List of (shape, dtype) tuples for tensor data
2195
- metadata : dict, optional
2196
- Additional metadata dictionary containing framework info,
2197
- training details, performance metrics, etc.
2198
- input_features : FeatureReference, str, optional
2254
+ name
2255
+ Unique name for the model.
2256
+ aliases
2257
+ List of version aliases (e.g., `["v1.0", "latest"]`).
2258
+ model
2259
+ Python model object (for object-based registration).
2260
+ model_paths
2261
+ Paths to model files (for file-based registration).
2262
+ additional_files
2263
+ Additional files needed for inference (tokenizers, configs, etc.)
2264
+ model_type
2265
+ Type of model framework
2266
+ model_encoding
2267
+ Serialization format
2268
+ input_schema
2269
+ Definition of the input schema. Can be:
2270
+ - `dict`: Dictionary mapping column names to dtypes for tabular data
2271
+ - `list`: List of `(shape, dtype)` tuples for tensor data
2272
+ output_schema
2273
+ Definition of the output schema. Can be:
2274
+ - `dict`: Dictionary mapping column names to dtypes for tabular data
2275
+ - `list`: List of `(shape, dtype)` tuples for tensor data
2276
+ metadata
2277
+ Additional metadata dictionary containing framework info,
2278
+ training details, performance metrics, etc.
2279
+ input_features
2199
2280
  The features to be used as inputs to the model.
2200
2281
  For example, `[User.message]`. Features can also be expressed as snakecased strings,
2201
- e.g. `["user.message"]`
2202
- output_features : FeatureReference, str, optional
2282
+ e.g. `["user.message"]`.
2283
+ output_features
2203
2284
  The features to be used as outputs to the model.
2204
2285
  For example, `[User.is_spam]`. Features can also be expressed as snakecased strings,
2205
- e.g. `["user.is_spam"]`
2206
- source_config : LocalSourceConfig, S3SourceConfig, HFSourceConfig, optional
2286
+ e.g. `["user.is_spam"]`.
2287
+ source_config
2207
2288
  Config to pass credentials to access files from a remote source.
2208
- dependencies : List[str], optional
2289
+ dependencies
2209
2290
  List of package dependencies needed to run this model.
2210
- e.g. ["torch==2.7.1", "numpy==1.26.4"]
2291
+ e.g. `["torch==2.7.1", "numpy==1.26.4"]`.
2292
+
2211
2293
  Returns
2212
2294
  -------
2213
2295
  ModelVersion
@@ -2250,6 +2332,7 @@ class ChalkClient:
2250
2332
  name: str,
2251
2333
  model_artifact_id: Optional[str] = None,
2252
2334
  run_id: Optional[str] = None,
2335
+ run_name: Optional[str] = None,
2253
2336
  criterion: Optional[ModelRunCriterion] = None,
2254
2337
  aliases: Optional[List[str]] = None,
2255
2338
  ) -> RegisterModelVersionResponse:
@@ -2264,6 +2347,8 @@ class ChalkClient:
2264
2347
  Artifact UUID to promote to a model version.
2265
2348
  run_id: str, optional
2266
2349
  run id that produce the artifact to promote.
2350
+ run_name: str, optional
2351
+ run name used in the checkpointer for artifact to promote.
2267
2352
  criterion: ModelRunCriterion, optional
2268
2353
  criterion on which to select the artifact from the training run.
2269
2354
  If none provided, the latest artifact in the run will be selected.
@@ -9,11 +9,13 @@ from uuid import UUID
9
9
  from chalk import DataFrame
10
10
  from chalk.client.models import (
11
11
  BulkOnlineQueryResponse,
12
+ BulkOnlineQueryResult,
12
13
  FeatureReference,
13
14
  FeatureStatisticsResponse,
14
15
  OfflineQueryInputUri,
15
16
  OnlineQuery,
16
17
  OnlineQueryContext,
18
+ PlanQueryResponse,
17
19
  ResourceRequests,
18
20
  UploadFeaturesResponse,
19
21
  WhoAmIResponse,
@@ -26,6 +28,7 @@ from chalk.prompts import Prompt
26
28
  if TYPE_CHECKING:
27
29
  import pandas as pd
28
30
  import polars as pl
31
+ import pyarrow as pa
29
32
 
30
33
  QueryInput = Mapping[FeatureReference, Any] | pd.DataFrame | pl.DataFrame | DataFrame | str
31
34
 
@@ -467,6 +470,147 @@ class AsyncChalkClient:
467
470
  """
468
471
  ...
469
472
 
473
+ async def plan_query(
474
+ self,
475
+ input: Sequence[FeatureReference],
476
+ output: Sequence[FeatureReference],
477
+ staleness: Mapping[FeatureReference, str] | None = None,
478
+ environment: EnvironmentId | None = None,
479
+ tags: list[str] | None = None,
480
+ preview_deployment_id: str | None = None,
481
+ branch: Union[BranchId, None] = ...,
482
+ query_name: str | None = None,
483
+ query_name_version: str | None = None,
484
+ meta: Mapping[str, str] | None = None,
485
+ store_plan_stages: bool = False,
486
+ explain: bool = False,
487
+ num_input_rows: Optional[int] = None,
488
+ headers: Mapping[str, str] | None = None,
489
+ ) -> PlanQueryResponse:
490
+ """Plan a query without executing it.
491
+
492
+ Parameters
493
+ ----------
494
+ input
495
+ The features for which there are known values, mapped to those values.
496
+ For example, `{User.id: 1234}`. Features can also be expressed as snakecased strings,
497
+ e.g. `{"user.id": 1234}`
498
+ output
499
+ Outputs are the features that you'd like to compute from the inputs.
500
+ For example, `[User.age, User.name, User.email]`.
501
+ staleness
502
+ Maximum staleness overrides for any output features or intermediate features.
503
+ See https://docs.chalk.ai/docs/query-caching for more information.
504
+ environment
505
+ The environment under which to run the resolvers.
506
+ API tokens can be scoped to an environment.
507
+ If no environment is specified in the query,
508
+ but the token supports only a single environment,
509
+ then that environment will be taken as the scope
510
+ for executing the request.
511
+ tags
512
+ The tags used to scope the resolvers.
513
+ See https://docs.chalk.ai/docs/resolver-tags for more information.
514
+ branch
515
+ If specified, Chalk will route your request to the relevant branch.
516
+ preview_deployment_id
517
+ If specified, Chalk will route your request to the relevant preview deployment.
518
+ query_name
519
+ The semantic name for the query you're making, for example, `"loan_application_model"`.
520
+ Typically, each query that you make from your application should have a name.
521
+ Chalk will present metrics and dashboard functionality grouped by 'query_name'.
522
+ If your query name matches a `NamedQuery`, the query will automatically pull outputs
523
+ and options specified in the matching `NamedQuery`.
524
+ query_name_version
525
+ If `query_name` is specified, this specifies the version of the named query you're making.
526
+ This is only useful if you want your query to use a `NamedQuery` with a specific name and a
527
+ specific version. If a `query_name` has not been supplied, then this parameter is ignored.
528
+ meta
529
+ Arbitrary `key:value` pairs to associate with a query.
530
+ store_plan_stages
531
+ If true, the plan will store the intermediate values at each stage in the plan
532
+ explain
533
+ If true, the plan will emit additional output to assist with debugging.
534
+ num_input_rows:
535
+ The number of input rows that this plan will be run with. If unknown, specify `None`.
536
+ headers
537
+ Additional headers to provide with the request
538
+
539
+ Returns
540
+ -------
541
+ PlanQueryResponse
542
+ The query plan, including the resolver execution order and the
543
+ resolver execution plan for each resolver.
544
+
545
+ Examples
546
+ --------
547
+ >>> from chalk.client import AsyncChalkClient
548
+ >>> result = await AsyncChalkClient().plan_query(
549
+ ... input=[User.id],
550
+ ... output=[User.fico_score],
551
+ ... staleness={User.fico_score: "10m"},
552
+ ... )
553
+ >>> result.rendered_plan
554
+ >>> result.output_schema
555
+ """
556
+ ...
557
+
558
+ async def _run_serialized_query(
559
+ self,
560
+ serialized_plan_bytes: bytes,
561
+ input: Union[Mapping[FeatureReference, Sequence[Any]], pa.Table],
562
+ output: Sequence[FeatureReference] = (),
563
+ staleness: Mapping[FeatureReference, str] | None = None,
564
+ context: OnlineQueryContext | None = None,
565
+ query_name: str | None = None,
566
+ query_name_version: str | None = None,
567
+ correlation_id: str | None = None,
568
+ include_meta: bool = False,
569
+ explain: bool = False,
570
+ store_plan_stages: bool = False,
571
+ meta: Mapping[str, str] | None = None,
572
+ headers: Mapping[str, str] | None = None,
573
+ ) -> BulkOnlineQueryResult:
574
+ """Run a query using a pre-serialized plan.
575
+
576
+ This is a protected method for internal use and testing.
577
+
578
+ Parameters
579
+ ----------
580
+ serialized_plan_bytes
581
+ The serialized BatchPlan protobuf bytes
582
+ input
583
+ The input data, either as a mapping of features to values or as a PyArrow table
584
+ output
585
+ The output features to compute
586
+ staleness
587
+ Maximum staleness overrides for features
588
+ context
589
+ Query context including environment and tags
590
+ query_name
591
+ The name of the query
592
+ query_name_version
593
+ The version of the query
594
+ correlation_id
595
+ Correlation ID for logging
596
+ include_meta
597
+ Whether to include metadata in the response
598
+ explain
599
+ Whether to include explain output
600
+ store_plan_stages
601
+ Whether to store plan stages
602
+ meta
603
+ Customer metadata tags
604
+ headers
605
+ Additional headers to provide with the request
606
+
607
+ Returns
608
+ -------
609
+ OnlineQueryResult
610
+ The query result
611
+ """
612
+ ...
613
+
470
614
  async def offline_query(
471
615
  self,
472
616
  input: Union[QueryInput, OfflineQueryInputUri] | None = None,
@@ -502,6 +646,8 @@ class AsyncChalkClient:
502
646
  max_retries: int | None = None,
503
647
  query_name: str | None = None,
504
648
  query_name_version: str | None = None,
649
+ *,
650
+ input_sql: str | None = None,
505
651
  ) -> Dataset:
506
652
  """Compute feature values from the offline store or by running offline/online resolvers.
507
653
  See `Dataset` for more information.
@@ -516,6 +662,9 @@ class AsyncChalkClient:
516
662
  an observation in line with the timestamp in `input_times`.
517
663
  input_times
518
664
  A list of the times of the observations from `input`.
665
+ input_sql
666
+ An alternative to `input`: a ChalkSQL query that returns values
667
+ to use as inputs.
519
668
  output
520
669
  The features that you'd like to sample, if they exist.
521
670
  If an output feature was never computed for a sample (row) in
@@ -18,8 +18,10 @@ from chalk.client.client_impl import ChalkAPIClientImpl, OnlineQueryResponseImpl
18
18
  from chalk.client.dataset import Dataset, DatasetImpl
19
19
  from chalk.client.models import (
20
20
  BulkOnlineQueryResponse,
21
+ BulkOnlineQueryResult,
21
22
  ChalkError,
22
23
  FeatureStatisticsResponse,
24
+ PlanQueryResponse,
23
25
  UploadFeaturesResponse,
24
26
  WhoAmIResponse,
25
27
  )
@@ -142,6 +144,26 @@ class AsyncChalkClientImpl(AsyncChalkClient):
142
144
  partial(self._client.query_bulk, *args, **kwargs),
143
145
  )
144
146
 
147
+ async def plan_query(
148
+ self,
149
+ *args: Any,
150
+ **kwargs: Any,
151
+ ) -> PlanQueryResponse:
152
+ return await self._current_loop().run_in_executor(
153
+ self._executor,
154
+ partial(self._client.plan_query, *args, **kwargs),
155
+ )
156
+
157
+ async def _run_serialized_query(
158
+ self,
159
+ *args: Any,
160
+ **kwargs: Any,
161
+ ) -> BulkOnlineQueryResult:
162
+ return await self._current_loop().run_in_executor(
163
+ self._executor,
164
+ partial(self._client._run_serialized_query, *args, **kwargs), # pyright: ignore[reportPrivateUsage]
165
+ )
166
+
145
167
  async def offline_query(
146
168
  self,
147
169
  *args: Any,