shaped 2.0.2__py3-none-any.whl → 2.0.5__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 (283) hide show
  1. shaped/__init__.py +47 -42
  2. shaped/autogen/__init__.py +41 -56
  3. shaped/autogen/api/engine_api.py +5 -6
  4. shaped/autogen/api/query_api.py +12 -73
  5. shaped/autogen/api/table_api.py +5 -6
  6. shaped/autogen/api/view_api.py +5 -6
  7. shaped/autogen/api_client.py +8 -9
  8. shaped/autogen/configuration.py +9 -8
  9. shaped/autogen/exceptions.py +11 -9
  10. shaped/autogen/models/__init__.py +23 -31
  11. shaped/autogen/models/ai_enrichment_view_config.py +5 -6
  12. shaped/autogen/models/algorithm.py +5 -6
  13. shaped/autogen/models/amplitude_table_config.py +5 -6
  14. shaped/autogen/models/attn_dropout_prob.py +5 -6
  15. shaped/autogen/models/attribute_journey.py +5 -6
  16. shaped/autogen/models/attribute_value.py +5 -6
  17. shaped/autogen/models/autoscaling_config.py +5 -6
  18. shaped/autogen/models/aws_pinpoint_table_config.py +5 -6
  19. shaped/autogen/models/batch_size.py +5 -6
  20. shaped/autogen/models/batch_size1.py +5 -6
  21. shaped/autogen/models/batch_size2.py +5 -6
  22. shaped/autogen/models/big_query_table_config.py +5 -6
  23. shaped/autogen/models/bm25.py +5 -6
  24. shaped/autogen/models/boosted_reorder_step.py +5 -6
  25. shaped/autogen/models/canary_rollout.py +5 -6
  26. shaped/autogen/models/candidate_attributes_retrieve_step.py +5 -19
  27. shaped/autogen/models/candidate_ids_retrieve_step.py +5 -6
  28. shaped/autogen/models/candidate_retrieval_strategy.py +5 -6
  29. shaped/autogen/models/clickhouse_table_config.py +5 -6
  30. shaped/autogen/models/column_order_retrieve_step.py +5 -6
  31. shaped/autogen/models/column_ordering.py +5 -6
  32. shaped/autogen/models/create_table_response.py +5 -6
  33. shaped/autogen/models/create_view_response.py +5 -6
  34. shaped/autogen/models/custom_table_config.py +5 -6
  35. shaped/autogen/models/data_compute_config.py +5 -6
  36. shaped/autogen/models/data_config.py +5 -6
  37. shaped/autogen/models/data_config_interaction_table.py +5 -6
  38. shaped/autogen/models/data_split_config.py +5 -6
  39. shaped/autogen/models/data_split_strategy.py +5 -6
  40. shaped/autogen/models/data_tier.py +5 -6
  41. shaped/autogen/models/default.py +5 -6
  42. shaped/autogen/models/delete_engine_response.py +5 -6
  43. shaped/autogen/models/delete_table_response.py +5 -6
  44. shaped/autogen/models/delete_view_response.py +5 -6
  45. shaped/autogen/models/deployment_config.py +6 -13
  46. shaped/autogen/models/diversity_reorder_step.py +5 -6
  47. shaped/autogen/models/dropout_rate.py +5 -6
  48. shaped/autogen/models/dynamo_db_table_config.py +5 -6
  49. shaped/autogen/models/dynamo_db_table_config_scan_kwargs_value.py +5 -6
  50. shaped/autogen/models/embedder_batch_size.py +5 -6
  51. shaped/autogen/models/embedding_config.py +5 -6
  52. shaped/autogen/models/embedding_dim.py +5 -6
  53. shaped/autogen/models/embedding_dims.py +5 -6
  54. shaped/autogen/models/embedding_size.py +5 -6
  55. shaped/autogen/models/encoder.py +5 -6
  56. shaped/autogen/models/engine.py +5 -6
  57. shaped/autogen/models/engine_config_v2.py +5 -6
  58. shaped/autogen/models/engine_details_response.py +5 -6
  59. shaped/autogen/models/engine_schema.py +12 -13
  60. shaped/autogen/models/entity_config.py +5 -6
  61. shaped/autogen/models/entity_journey.py +32 -24
  62. shaped/autogen/models/entity_type.py +5 -6
  63. shaped/autogen/models/evaluation_config.py +5 -6
  64. shaped/autogen/models/exploration_reorder_step.py +5 -6
  65. shaped/autogen/models/expression_filter_step.py +5 -6
  66. shaped/autogen/models/factors.py +5 -6
  67. shaped/autogen/models/factors1.py +5 -6
  68. shaped/autogen/models/feature.py +5 -6
  69. shaped/autogen/models/feature_type.py +5 -6
  70. shaped/autogen/models/file_table_config.py +5 -6
  71. shaped/autogen/models/filter_config.py +18 -19
  72. shaped/autogen/models/filter_index_type.py +5 -6
  73. shaped/autogen/models/filter_retrieve_step.py +5 -6
  74. shaped/autogen/models/filter_step_explanation.py +164 -0
  75. shaped/autogen/models/{filter_dataset.py → filter_table.py} +12 -13
  76. shaped/autogen/models/{type.py → filter_type.py} +10 -11
  77. shaped/autogen/models/global_filter.py +5 -6
  78. shaped/autogen/models/hidden_dropout_prob.py +5 -6
  79. shaped/autogen/models/hidden_size.py +5 -6
  80. shaped/autogen/models/hidden_size1.py +5 -6
  81. shaped/autogen/models/http_problem_response.py +5 -6
  82. shaped/autogen/models/http_validation_error.py +5 -6
  83. shaped/autogen/models/hugging_face_encoder.py +10 -9
  84. shaped/autogen/models/iceberg_table_config.py +5 -6
  85. shaped/autogen/models/index_config.py +5 -6
  86. shaped/autogen/models/{time_window_in_days.py → inner_entity_id.py} +27 -26
  87. shaped/autogen/models/inner_size.py +5 -6
  88. shaped/autogen/models/inner_size1.py +5 -6
  89. shaped/autogen/models/{mode2.py → inner_uid.py} +37 -30
  90. shaped/autogen/models/interaction_config.py +5 -6
  91. shaped/autogen/models/interaction_pooling_encoder.py +5 -6
  92. shaped/autogen/models/interaction_round_robin_encoder.py +5 -6
  93. shaped/autogen/models/item_attribute_pooling_encoder.py +5 -19
  94. shaped/autogen/models/journey.py +5 -6
  95. shaped/autogen/models/kafka_table_config.py +5 -6
  96. shaped/autogen/models/kinesis_table_config.py +5 -6
  97. shaped/autogen/models/kinesis_table_config_column_schema_value.py +5 -6
  98. shaped/autogen/models/label.py +5 -6
  99. shaped/autogen/models/label_type.py +5 -7
  100. shaped/autogen/models/laplace_smoothing.py +5 -6
  101. shaped/autogen/models/latency_scaling_policy.py +5 -6
  102. shaped/autogen/models/learning_rate.py +5 -6
  103. shaped/autogen/models/learning_rate1.py +5 -6
  104. shaped/autogen/models/learning_rate2.py +5 -6
  105. shaped/autogen/models/learning_rate3.py +5 -6
  106. shaped/autogen/models/lexical_search_mode.py +7 -8
  107. shaped/autogen/models/list_engines_response.py +5 -6
  108. shaped/autogen/models/list_tables_response.py +5 -6
  109. shaped/autogen/models/list_views_response.py +5 -6
  110. shaped/autogen/models/{validation_error_loc_inner.py → location_inner.py} +11 -12
  111. shaped/autogen/models/loss_types.py +5 -6
  112. shaped/autogen/models/lr.py +5 -6
  113. shaped/autogen/models/lr1.py +5 -6
  114. shaped/autogen/models/lr2.py +5 -6
  115. shaped/autogen/models/max_depth.py +5 -6
  116. shaped/autogen/models/max_leaves.py +5 -6
  117. shaped/autogen/models/max_seq_length.py +5 -6
  118. shaped/autogen/models/max_seq_length1.py +5 -6
  119. shaped/autogen/models/max_seq_length2.py +5 -6
  120. shaped/autogen/models/mode.py +5 -6
  121. shaped/autogen/models/mode1.py +24 -23
  122. shaped/autogen/models/{training_config_models_inner.py → models_inner.py} +13 -14
  123. shaped/autogen/models/mongo_db_table_config.py +5 -6
  124. shaped/autogen/models/mssql_table_config.py +5 -6
  125. shaped/autogen/models/my_sql_table_config.py +5 -6
  126. shaped/autogen/models/n_epochs.py +5 -6
  127. shaped/autogen/models/n_epochs1.py +5 -6
  128. shaped/autogen/models/n_epochs2.py +5 -6
  129. shaped/autogen/models/n_estimators.py +5 -6
  130. shaped/autogen/models/n_heads.py +5 -6
  131. shaped/autogen/models/n_layers.py +5 -6
  132. shaped/autogen/models/neg_per_positive.py +5 -6
  133. shaped/autogen/models/negative_samples_count.py +5 -6
  134. shaped/autogen/models/ngram_tokenizer.py +5 -6
  135. shaped/autogen/models/no_op_config.py +5 -6
  136. shaped/autogen/models/num_blocks.py +5 -6
  137. shaped/autogen/models/num_heads.py +5 -6
  138. shaped/autogen/models/num_leaves.py +5 -6
  139. shaped/autogen/models/objective.py +5 -6
  140. shaped/autogen/models/objective1.py +5 -6
  141. shaped/autogen/models/online_store_config.py +5 -6
  142. shaped/autogen/models/pagination_config.py +5 -6
  143. shaped/autogen/models/parameter_definition.py +5 -6
  144. shaped/autogen/models/parameters_value.py +5 -6
  145. shaped/autogen/models/passthrough_score.py +5 -6
  146. shaped/autogen/models/personal_filter.py +5 -6
  147. shaped/autogen/models/pipeline_stage_explanation.py +8 -9
  148. shaped/autogen/models/policy.py +5 -6
  149. shaped/autogen/models/pooling_function.py +5 -6
  150. shaped/autogen/models/postgres_table_config.py +5 -6
  151. shaped/autogen/models/posthog_table_config.py +5 -6
  152. shaped/autogen/models/prebuilt_filter_step.py +5 -6
  153. shaped/autogen/models/precomputed_item_embedding.py +5 -6
  154. shaped/autogen/models/precomputed_user_embedding.py +5 -6
  155. shaped/autogen/models/query.py +19 -20
  156. shaped/autogen/models/query1.py +19 -20
  157. shaped/autogen/models/{query_any_of.py → query_config.py} +13 -14
  158. shaped/autogen/models/query_definition.py +5 -6
  159. shaped/autogen/models/query_encoder.py +5 -6
  160. shaped/autogen/models/query_explanation.py +11 -8
  161. shaped/autogen/models/query_request.py +5 -6
  162. shaped/autogen/models/query_result.py +5 -6
  163. shaped/autogen/models/query_table_config.py +5 -6
  164. shaped/autogen/models/rank_item_attribute_values_query_config.py +5 -6
  165. shaped/autogen/models/rank_query_config.py +11 -12
  166. shaped/autogen/models/rank_query_config_filter_inner.py +5 -6
  167. shaped/autogen/models/recreate_rollout.py +5 -6
  168. shaped/autogen/models/redshift_table_config.py +5 -6
  169. shaped/autogen/models/reference_table_config.py +5 -6
  170. shaped/autogen/models/regularization.py +5 -6
  171. shaped/autogen/models/{rank_query_config_reorder_inner.py → reorder_inner.py} +11 -12
  172. shaped/autogen/models/reorder_step_explanation.py +206 -0
  173. shaped/autogen/models/request.py +5 -6
  174. shaped/autogen/models/request1.py +5 -6
  175. shaped/autogen/models/requests_per_second_scaling_policy.py +5 -6
  176. shaped/autogen/models/resource_config.py +99 -0
  177. shaped/autogen/models/response_get_view_details_views_view_name_get.py +5 -6
  178. shaped/autogen/models/result.py +5 -19
  179. shaped/autogen/models/result_embeddings_value.py +5 -6
  180. shaped/autogen/models/{ascending.py → retrieval_scores_value.py} +26 -36
  181. shaped/autogen/models/{rank_query_config_retrieve_inner.py → retrieve_inner.py} +13 -14
  182. shaped/autogen/models/retrieve_step_explanation.py +171 -0
  183. shaped/autogen/models/retriever.py +5 -6
  184. shaped/autogen/models/retriever1.py +5 -6
  185. shaped/autogen/models/rollout_config.py +5 -6
  186. shaped/autogen/models/rudderstack_table_config.py +5 -6
  187. shaped/autogen/models/sampling_strategy.py +5 -6
  188. shaped/autogen/models/saved_query_info_response.py +22 -9
  189. shaped/autogen/models/saved_query_list_response.py +5 -6
  190. shaped/autogen/models/saved_query_request.py +5 -6
  191. shaped/autogen/models/schema_config.py +5 -6
  192. shaped/autogen/models/score.py +5 -6
  193. shaped/autogen/models/score_ensemble.py +5 -19
  194. shaped/autogen/models/score_step_explanation.py +223 -0
  195. shaped/autogen/models/search_config.py +5 -6
  196. shaped/autogen/models/segment_table_config.py +5 -6
  197. shaped/autogen/models/sequence_length.py +5 -6
  198. shaped/autogen/models/server_config.py +18 -6
  199. shaped/autogen/models/setup_engine_response.py +5 -6
  200. shaped/autogen/models/shaped_internal_recsys_policies_als_model_policy_als_model_policy_config.py +13 -8
  201. shaped/autogen/models/shaped_internal_recsys_policies_beeformer_model_policy_beeformer_model_policy_beeformer_model_policy_config.py +13 -8
  202. shaped/autogen/models/shaped_internal_recsys_policies_bert_model_policy_bert_model_policy_bert_model_policy_config.py +14 -9
  203. shaped/autogen/models/shaped_internal_recsys_policies_elsa_model_policy_elsa_model_policy_elsa_model_policy_config.py +10 -9
  204. shaped/autogen/models/shaped_internal_recsys_policies_gsasrec_model_policy_gsasrec_model_policy_gsas_rec_model_policy_config.py +13 -8
  205. shaped/autogen/models/shaped_internal_recsys_policies_item2vec_model_policy_item2_vec_model_policy_config.py +5 -6
  206. shaped/autogen/models/shaped_internal_recsys_policies_lightgbm_model_policy_lightgbm_model_policy_light_gbm_model_policy_config.py +13 -8
  207. shaped/autogen/models/shaped_internal_recsys_policies_ngram_model_policy_ngram_model_policy_config.py +5 -6
  208. shaped/autogen/models/shaped_internal_recsys_policies_rising_popular_policy_rising_popular_policy_config.py +5 -6
  209. shaped/autogen/models/shaped_internal_recsys_policies_sasrec_model_policy_sasrec_model_policy_sas_rec_model_policy_config.py +13 -8
  210. shaped/autogen/models/shaped_internal_recsys_policies_svd_model_policy_svd_model_policy_config.py +5 -6
  211. shaped/autogen/models/shaped_internal_recsys_policies_two_tower_model_policy_two_tower_model_policy_two_tower_model_policy_config.py +13 -8
  212. shaped/autogen/models/shaped_internal_recsys_policies_widedeep_model_policy_wide_deep_model_policy_config.py +14 -9
  213. shaped/autogen/models/shaped_internal_recsys_policies_xgboost_model_policy_xg_boost_model_policy_config.py +16 -11
  214. shaped/autogen/models/shopify_table_config.py +5 -6
  215. shaped/autogen/models/similarity_retrieve_step.py +10 -9
  216. shaped/autogen/models/snowflake_table_config.py +5 -6
  217. shaped/autogen/models/sql_transform_type.py +5 -6
  218. shaped/autogen/models/sql_view_config.py +5 -6
  219. shaped/autogen/models/stemmer_tokenizer.py +5 -6
  220. shaped/autogen/models/step_explanation.py +5 -6
  221. shaped/autogen/models/steps_inner.py +178 -0
  222. shaped/autogen/models/strategy.py +5 -6
  223. shaped/autogen/models/table.py +5 -6
  224. shaped/autogen/models/table_deployment_type.py +5 -6
  225. shaped/autogen/models/table_insert_arguments.py +7 -8
  226. shaped/autogen/models/table_insert_response.py +5 -6
  227. shaped/autogen/models/text_search_retrieve_step.py +5 -6
  228. shaped/autogen/models/time_frequency.py +5 -6
  229. shaped/autogen/models/time_window.py +5 -6
  230. shaped/autogen/models/tokenizer.py +5 -6
  231. shaped/autogen/models/trained_model_encoder.py +5 -6
  232. shaped/autogen/models/training_compute_config.py +8 -9
  233. shaped/autogen/models/training_config.py +8 -9
  234. shaped/autogen/models/training_strategy.py +5 -6
  235. shaped/autogen/models/transform_status.py +40 -0
  236. shaped/autogen/models/truncate_filter_step.py +5 -6
  237. shaped/autogen/models/tunable_bool.py +5 -6
  238. shaped/autogen/models/tunable_float.py +5 -6
  239. shaped/autogen/models/tunable_int.py +5 -6
  240. shaped/autogen/models/tunable_int_categorical.py +5 -6
  241. shaped/autogen/models/tunable_string.py +5 -6
  242. shaped/autogen/models/tuning_config.py +5 -6
  243. shaped/autogen/models/update_table_response.py +5 -6
  244. shaped/autogen/models/update_view_response.py +5 -6
  245. shaped/autogen/models/user_attribute_pooling_encoder.py +5 -6
  246. shaped/autogen/models/{engine_schema_user_inner.py → user_inner.py} +11 -12
  247. shaped/autogen/models/val_split.py +5 -6
  248. shaped/autogen/models/validation_error.py +8 -9
  249. shaped/autogen/models/value_type.py +5 -6
  250. shaped/autogen/models/vector_search_mode.py +10 -9
  251. shaped/autogen/models/view.py +8 -9
  252. shaped/autogen/models/view_details_ai.py +10 -11
  253. shaped/autogen/models/view_details_ai_schema_value.py +5 -6
  254. shaped/autogen/models/view_details_sql.py +10 -11
  255. shaped/autogen/models/weight_decay.py +5 -6
  256. shaped/autogen/models/whitespace_tokenizer.py +5 -6
  257. shaped/autogen/models/window_size.py +5 -6
  258. shaped/autogen/rest.py +13 -14
  259. shaped/cli/shaped_cli.py +152 -29
  260. shaped/client.py +50 -43
  261. shaped/config_builders.py +110 -100
  262. shaped/query_builder.py +56 -49
  263. {shaped-2.0.2.dist-info → shaped-2.0.5.dist-info}/METADATA +2 -2
  264. shaped-2.0.5.dist-info/RECORD +271 -0
  265. {shaped-2.0.2.dist-info → shaped-2.0.5.dist-info}/WHEEL +1 -1
  266. shaped/autogen/models/distance_function.py +0 -38
  267. shaped/autogen/models/encoding_pooling_strategy.py +0 -38
  268. shaped/autogen/models/pool_fn.py +0 -134
  269. shaped/autogen/models/score_ensemble_policy_config.py +0 -141
  270. shaped/autogen/models/score_ensemble_policy_config_policies_inner.py +0 -422
  271. shaped/autogen/models/shaped_internal_recsys_policies_chronological_model_policy_chronological_model_policy_config.py +0 -137
  272. shaped/autogen/models/shaped_internal_recsys_policies_item_content_similarity_model_policy_item_content_similarity_model_policy_config.py +0 -152
  273. shaped/autogen/models/shaped_internal_recsys_policies_popular_model_policy_popular_model_policy_config.py +0 -137
  274. shaped/autogen/models/shaped_internal_recsys_policies_random_model_policy_random_model_policy_config.py +0 -104
  275. shaped/autogen/models/shaped_internal_recsys_policies_recently_popular_policy_recently_popular_policy_config.py +0 -130
  276. shaped/autogen/models/shaped_internal_recsys_policies_user_item_content_similarity_model_policy_user_item_content_similarity_model_policy_config.py +0 -131
  277. shaped/autogen/models/text_encoding.py +0 -136
  278. shaped/autogen/models/trending_mode.py +0 -37
  279. shaped/autogen/models/view_status.py +0 -41
  280. shaped-2.0.2.dist-info/RECORD +0 -278
  281. {shaped-2.0.2.dist-info → shaped-2.0.5.dist-info}/entry_points.txt +0 -0
  282. {shaped-2.0.2.dist-info → shaped-2.0.5.dist-info}/top_level.txt +0 -0
  283. {shaped-2.0.2.dist-info → shaped-2.0.5.dist-info}/zip-safe +0 -0
shaped/config_builders.py CHANGED
@@ -4,47 +4,50 @@ Fluent builders for constructing Shaped V2 configurations.
4
4
  This module provides a fluent API for building Engine, Table, and View configurations
5
5
  using Python objects instead of raw dictionaries or complex model instantiation.
6
6
  """
7
- from typing import Any, Dict, List, Optional, Union
8
7
 
9
- from shaped.autogen.models.engine_config_v2 import EngineConfigV2
10
- from shaped.autogen.models.data_config import DataConfig
11
- from shaped.autogen.models.data_config_interaction_table import DataConfigInteractionTable
12
- from shaped.autogen.models.reference_table_config import ReferenceTableConfig
13
- from shaped.autogen.models.query_table_config import QueryTableConfig
8
+ from typing import Any, Dict, List, Optional, Union
14
9
 
15
- # Table Config Imports
16
- from shaped.autogen.models.postgres_table_config import PostgresTableConfig
17
- from shaped.autogen.models.big_query_table_config import BigQueryTableConfig
18
- from shaped.autogen.models.snowflake_table_config import SnowflakeTableConfig
19
- from shaped.autogen.models.file_table_config import FileTableConfig
10
+ from shaped.autogen.models.ai_enrichment_view_config import AIEnrichmentViewConfig
20
11
  from shaped.autogen.models.amplitude_table_config import AmplitudeTableConfig
21
12
  from shaped.autogen.models.aws_pinpoint_table_config import AWSPinpointTableConfig
13
+ from shaped.autogen.models.big_query_table_config import BigQueryTableConfig
22
14
  from shaped.autogen.models.clickhouse_table_config import ClickhouseTableConfig
23
15
  from shaped.autogen.models.custom_table_config import CustomTableConfig
16
+ from shaped.autogen.models.data_config import DataConfig
17
+ from shaped.autogen.models.data_config_interaction_table import (
18
+ DataConfigInteractionTable,
19
+ )
20
+ from shaped.autogen.models.deployment_config import DeploymentConfig
24
21
  from shaped.autogen.models.dynamo_db_table_config import DynamoDBTableConfig
22
+ from shaped.autogen.models.engine_config_v2 import EngineConfigV2
23
+ from shaped.autogen.models.file_table_config import FileTableConfig
25
24
  from shaped.autogen.models.iceberg_table_config import IcebergTableConfig
25
+
26
+ # Other Imports
27
+ from shaped.autogen.models.index_config import IndexConfig
26
28
  from shaped.autogen.models.kafka_table_config import KafkaTableConfig
27
29
  from shaped.autogen.models.kinesis_table_config import KinesisTableConfig
28
30
  from shaped.autogen.models.mongo_db_table_config import MongoDBTableConfig
29
31
  from shaped.autogen.models.mssql_table_config import MSSQLTableConfig
30
32
  from shaped.autogen.models.my_sql_table_config import MySQLTableConfig
33
+
34
+ # Table Config Imports
35
+ from shaped.autogen.models.postgres_table_config import PostgresTableConfig
31
36
  from shaped.autogen.models.posthog_table_config import PosthogTableConfig
37
+ from shaped.autogen.models.query_definition import QueryDefinition
38
+ from shaped.autogen.models.query_table_config import QueryTableConfig
39
+ from shaped.autogen.models.rank_query_config import RankQueryConfig
32
40
  from shaped.autogen.models.redshift_table_config import RedshiftTableConfig
41
+ from shaped.autogen.models.reference_table_config import ReferenceTableConfig
33
42
  from shaped.autogen.models.rudderstack_table_config import RudderstackTableConfig
34
43
  from shaped.autogen.models.segment_table_config import SegmentTableConfig
35
44
  from shaped.autogen.models.shopify_table_config import ShopifyTableConfig
45
+ from shaped.autogen.models.snowflake_table_config import SnowflakeTableConfig
46
+ from shaped.autogen.models.sql_transform_type import SQLTransformType
36
47
 
37
48
  # View Config Imports
38
49
  from shaped.autogen.models.sql_view_config import SQLViewConfig
39
- from shaped.autogen.models.ai_enrichment_view_config import AIEnrichmentViewConfig
40
- from shaped.autogen.models.sql_transform_type import SQLTransformType
41
-
42
- # Other Imports
43
- from shaped.autogen.models.index_config import IndexConfig
44
50
  from shaped.autogen.models.training_config import TrainingConfig
45
- from shaped.autogen.models.deployment_config import DeploymentConfig
46
- from shaped.autogen.models.query_definition import QueryDefinition
47
- from shaped.autogen.models.rank_query_config import RankQueryConfig
48
51
 
49
52
  # Type aliases for better type hints
50
53
  TableConfig = Union[
@@ -67,7 +70,7 @@ TableConfig = Union[
67
70
  RedshiftTableConfig,
68
71
  RudderstackTableConfig,
69
72
  SegmentTableConfig,
70
- ShopifyTableConfig
73
+ ShopifyTableConfig,
71
74
  ]
72
75
  ViewConfig = Union[SQLViewConfig, AIEnrichmentViewConfig]
73
76
 
@@ -75,7 +78,7 @@ ViewConfig = Union[SQLViewConfig, AIEnrichmentViewConfig]
75
78
  class Engine:
76
79
  """
77
80
  Builder for Engine configurations with support for all V2 features.
78
-
81
+
79
82
  Example:
80
83
  engine = (Engine("my-engine")
81
84
  .interactions("events")
@@ -86,11 +89,11 @@ class Engine:
86
89
  .with_deployment_config(...)
87
90
  .with_query("recommendations", "SELECT * FROM items ORDER BY score DESC"))
88
91
  """
89
-
92
+
90
93
  def __init__(self, name: str):
91
94
  if not name:
92
95
  raise ValueError("Engine name is required")
93
-
96
+
94
97
  self._name = name
95
98
  self._description: Optional[str] = None
96
99
  self._interactions: Optional[Union[str, Dict[str, Any]]] = None
@@ -106,187 +109,185 @@ class Engine:
106
109
  self._training_config: Dict[str, Any] = {}
107
110
  self._deployment_config: Dict[str, Any] = {}
108
111
  self._queries: Dict[str, QueryDefinition] = {}
109
-
112
+
110
113
  def description(self, description: str) -> "Engine":
111
114
  """Set the engine description."""
112
115
  self._description = description
113
116
  return self
114
-
117
+
115
118
  def interactions(self, table: Union[str, Dict[str, Any]]) -> "Engine":
116
119
  """Set the interactions table configuration."""
117
120
  self._interactions = table
118
121
  return self
119
-
122
+
120
123
  def users(self, table: Union[str, Dict[str, Any]]) -> "Engine":
121
124
  """Set the users table configuration."""
122
125
  self._users = table
123
126
  return self
124
-
127
+
125
128
  def items(self, table: Union[str, Dict[str, Any]]) -> "Engine":
126
129
  """Set the items table configuration."""
127
130
  self._items = table
128
131
  return self
129
-
132
+
130
133
  def schedule(self, schedule: str) -> "Engine":
131
134
  """Set the data refresh schedule."""
132
135
  self._schedule = schedule
133
136
  return self
134
-
137
+
135
138
  def with_schema_override(self, schema: Dict[str, Any]) -> "Engine":
136
139
  """Override the default schema detection with custom schema."""
137
140
  self._schema_override = schema
138
141
  return self
139
-
142
+
140
143
  def with_compute(self, compute: Dict[str, Any]) -> "Engine":
141
144
  """Configure compute resources for data processing."""
142
145
  self._compute = compute
143
146
  return self
144
-
147
+
145
148
  def add_filter(self, filter_config: Dict[str, Any]) -> "Engine":
146
149
  """
147
150
  Add a filter configuration.
148
-
151
+
149
152
  Args:
150
153
  filter_config: Dictionary containing filter configuration
151
-
154
+
152
155
  Returns:
153
156
  The Engine instance for method chaining
154
157
  """
155
158
  self._filters.append(filter_config)
156
159
  return self
157
-
160
+
158
161
  def add_filters(self, *filter_configs: Dict[str, Any]) -> "Engine":
159
162
  """
160
163
  Add multiple filter configurations at once.
161
-
164
+
162
165
  Args:
163
166
  *filter_configs: One or more filter configurations to add
164
-
167
+
165
168
  Returns:
166
169
  The Engine instance for method chaining
167
170
  """
168
171
  self._filters.extend(filter_configs)
169
172
  return self
170
-
173
+
171
174
  def add_reference_table(self, name: str, config: Dict[str, Any]) -> "Engine":
172
175
  """
173
176
  Add a reference table configuration.
174
-
177
+
175
178
  Args:
176
179
  name: Name of the reference table
177
180
  config: Configuration dictionary for the reference table
178
-
181
+
179
182
  Returns:
180
183
  The Engine instance for method chaining
181
184
  """
182
185
  self._reference_tables[name] = config
183
186
  return self
184
-
187
+
185
188
  def add_reference_tables(self, **tables: Dict[str, Any]) -> "Engine":
186
189
  """
187
190
  Add multiple reference tables at once using keyword arguments.
188
-
191
+
189
192
  Args:
190
193
  **tables: Keyword arguments where keys are table names and values are configs
191
-
194
+
192
195
  Returns:
193
196
  The Engine instance for method chaining
194
197
  """
195
198
  self._reference_tables.update(tables)
196
199
  return self
197
-
200
+
198
201
  def with_tags(self, **tags: str) -> "Engine":
199
202
  """Add tags to the engine configuration."""
200
203
  if self._tags is None:
201
204
  self._tags = {}
202
205
  self._tags.update(tags)
203
206
  return self
204
-
207
+
205
208
  def with_index_config(self, config: IndexConfig) -> "Engine":
206
209
  """Configure index settings."""
207
210
  self._index_config = config
208
211
  return self
209
-
212
+
210
213
  def with_training_config(
211
214
  self,
212
215
  data_split_strategy: Optional[str] = None,
213
216
  data_split_params: Optional[Dict[str, Any]] = None,
214
- **kwargs
217
+ **kwargs,
215
218
  ) -> "Engine":
216
219
  """Configure model training settings."""
217
220
  if data_split_strategy:
218
221
  self._training_config["data_split"] = {
219
222
  "strategy": data_split_strategy,
220
- **(data_split_params or {})
223
+ **(data_split_params or {}),
221
224
  }
222
225
  self._training_config.update(kwargs)
223
226
  return self
224
-
227
+
225
228
  def with_deployment_config(self, **kwargs) -> "Engine":
226
229
  """Configure deployment settings."""
227
230
  self._deployment_config.update(kwargs)
228
231
  return self
229
-
232
+
230
233
  def with_query(self, name: str, query: Union[str, Dict[str, Any]]) -> "Engine":
231
234
  """Add a named query definition."""
232
235
  if isinstance(query, str):
233
236
  # Convert SQL string to a RankQueryConfig
234
- query_def = QueryDefinition(
235
- query=RankQueryConfig(type="rank", sql=query)
236
- )
237
+ query_def = QueryDefinition(query=RankQueryConfig(type="rank", sql=query))
237
238
  else:
238
239
  query_def = QueryDefinition(**query)
239
-
240
+
240
241
  self._queries[name] = query_def
241
242
  return self
242
-
243
+
243
244
  def validate(self) -> List[str]:
244
245
  """
245
246
  Validate the current configuration.
246
-
247
+
247
248
  Returns:
248
249
  List of error messages, empty if configuration is valid
249
250
  """
250
251
  errors = []
251
-
252
+
252
253
  if not self._interactions:
253
254
  errors.append("Interactions table is required")
254
-
255
+
255
256
  # Validate reference tables
256
257
  for name, config in self._reference_tables.items():
257
258
  if not isinstance(config, dict) or not config:
258
259
  errors.append(f"Invalid configuration for reference table '{name}'")
259
-
260
+
260
261
  # Validate queries
261
262
  for name, query in self._queries.items():
262
- if not query or not getattr(query, 'query', None):
263
+ if not query or not getattr(query, "query", None):
263
264
  errors.append(f"Invalid query definition for query '{name}'")
264
-
265
+
265
266
  return errors
266
-
267
+
267
268
  def is_valid(self) -> bool:
268
269
  """
269
270
  Check if the current configuration is valid.
270
-
271
+
271
272
  Returns:
272
273
  True if configuration is valid, False otherwise
273
274
  """
274
275
  return not bool(self.validate())
275
-
276
+
276
277
  def build(self) -> EngineConfigV2:
277
278
  """
278
279
  Build the EngineConfigV2 object with all configured settings.
279
-
280
+
280
281
  Returns:
281
282
  EngineConfigV2: The built engine configuration
282
-
283
+
283
284
  Raises:
284
285
  ValueError: If the configuration is invalid
285
286
  """
286
287
  # Validate before building
287
288
  if errors := self.validate():
288
289
  raise ValueError(f"Invalid configuration: {', '.join(errors)}")
289
-
290
+
290
291
  # Build data configuration
291
292
  data_config = DataConfig(
292
293
  interaction_table=self._create_data_table(self._interactions),
@@ -296,49 +297,51 @@ class Engine:
296
297
  schema=self._schema_override,
297
298
  compute=self._compute,
298
299
  filters=self._filters if self._filters else None,
299
- reference_tables=self._reference_tables if self._reference_tables else None
300
+ reference_tables=self._reference_tables if self._reference_tables else None,
300
301
  )
301
-
302
+
302
303
  # Build engine config
303
304
  config = EngineConfigV2(
304
305
  name=self._name,
305
306
  description=self._description,
306
307
  data=data_config,
307
308
  version="v2",
308
- tags=self._tags
309
+ tags=self._tags,
309
310
  )
310
-
311
+
311
312
  # Add optional configurations
312
313
  if self._index_config:
313
314
  config.index = self._index_config
314
-
315
+
315
316
  if self._training_config:
316
317
  config.training = TrainingConfig(**self._training_config)
317
-
318
+
318
319
  if self._deployment_config:
319
320
  config.deployment = DeploymentConfig(**self._deployment_config)
320
-
321
+
321
322
  if self._queries:
322
323
  config.queries = self._queries
323
-
324
+
324
325
  return config
325
326
 
326
- def _create_data_table(self, table: Union[str, Dict[str, Any], Any]) -> Optional[DataConfigInteractionTable]:
327
+ def _create_data_table(
328
+ self, table: Union[str, Dict[str, Any], Any]
329
+ ) -> Optional[DataConfigInteractionTable]:
327
330
  """
328
331
  Create a DataConfigInteractionTable from input.
329
-
332
+
330
333
  Args:
331
334
  table: Can be a table name (str), a table config dict, or an existing config object.
332
-
335
+
333
336
  Returns:
334
337
  A properly configured DataConfigInteractionTable instance, or None if input is None.
335
-
338
+
336
339
  Raises:
337
340
  ValueError: If the input cannot be converted to a valid table configuration.
338
341
  """
339
342
  if table is None:
340
343
  return None
341
-
344
+
342
345
  try:
343
346
  if isinstance(table, str):
344
347
  # It's a reference to a table by name
@@ -346,7 +349,7 @@ class Engine:
346
349
  # Create the DataConfigInteractionTable with the config
347
350
  result = DataConfigInteractionTable(actual_instance=config)
348
351
  return result
349
-
352
+
350
353
  if isinstance(table, dict):
351
354
  # It's a config dictionary
352
355
  if table.get("type") == "query":
@@ -357,13 +360,15 @@ class Engine:
357
360
  config = ReferenceTableConfig(**table)
358
361
  result = DataConfigInteractionTable(actual_instance=config)
359
362
  return result
360
-
363
+
361
364
  # Check if it's already a DataConfigInteractionTable
362
- if hasattr(table, 'actual_instance') and hasattr(table, 'to_dict'):
365
+ if hasattr(table, "actual_instance") and hasattr(table, "to_dict"):
363
366
  return table
364
-
365
- raise ValueError(f"Unsupported table configuration type: {type(table).__name__}")
366
-
367
+
368
+ raise ValueError(
369
+ f"Unsupported table configuration type: {type(table).__name__}"
370
+ )
371
+
367
372
  except Exception as e:
368
373
  raise ValueError(f"Failed to create data table: {str(e)}")
369
374
 
@@ -372,7 +377,7 @@ class Table:
372
377
  """
373
378
  Factory methods for Table configurations.
374
379
  """
375
-
380
+
376
381
  @staticmethod
377
382
  def Postgres(
378
383
  name: str,
@@ -384,7 +389,7 @@ class Table:
384
389
  table: str,
385
390
  replication_key: str,
386
391
  description: Optional[str] = None,
387
- schema: Optional[str] = None, # database_schema
392
+ schema: Optional[str] = None, # database_schema
388
393
  ssl_args: Optional[Dict[str, Any]] = None,
389
394
  ) -> PostgresTableConfig:
390
395
  """Create a Postgres table configuration."""
@@ -453,7 +458,7 @@ class Table:
453
458
  replication_key=replication_key,
454
459
  description=description,
455
460
  )
456
-
461
+
457
462
  @staticmethod
458
463
  def File(
459
464
  name: str,
@@ -484,7 +489,7 @@ class Table:
484
489
  ) -> MySQLTableConfig:
485
490
  """
486
491
  Create a MySQL table configuration.
487
-
492
+
488
493
  Args:
489
494
  name: Name of the table configuration
490
495
  host: MySQL server hostname or IP
@@ -496,7 +501,7 @@ class Table:
496
501
  replication_key: Column name to use for change data capture
497
502
  description: Optional description of the table
498
503
  ssl_args: Optional SSL configuration parameters
499
-
504
+
500
505
  Returns:
501
506
  MySQLTableConfig: Configured MySQL table configuration
502
507
  """
@@ -531,7 +536,7 @@ class Table:
531
536
  ) -> MSSQLTableConfig:
532
537
  """
533
538
  Create a Microsoft SQL Server table configuration.
534
-
539
+
535
540
  Args:
536
541
  name: Name of the table configuration
537
542
  host: SQL Server hostname or IP
@@ -544,7 +549,7 @@ class Table:
544
549
  replication_key: Column name to use for change data capture
545
550
  description: Optional description of the table
546
551
  ssl_args: Optional SSL configuration parameters
547
-
552
+
548
553
  Returns:
549
554
  MSSQLTableConfig: Configured SQL Server table configuration
550
555
  """
@@ -576,7 +581,7 @@ class Table:
576
581
  ) -> MongoDBTableConfig:
577
582
  """
578
583
  Create a MongoDB table configuration.
579
-
584
+
580
585
  Args:
581
586
  name: Name of the table configuration
582
587
  connection_uri: MongoDB connection URI
@@ -585,7 +590,7 @@ class Table:
585
590
  replication_key: Field name to use for change data capture
586
591
  description: Optional description of the table
587
592
  **kwargs: Additional MongoDB connection parameters
588
-
593
+
589
594
  Returns:
590
595
  MongoDBTableConfig: Configured MongoDB table configuration
591
596
  """
@@ -596,7 +601,7 @@ class Table:
596
601
  collection=collection,
597
602
  replication_key=replication_key,
598
603
  description=description,
599
- **kwargs
604
+ **kwargs,
600
605
  )
601
606
 
602
607
  @staticmethod
@@ -615,7 +620,7 @@ class Table:
615
620
  ) -> RedshiftTableConfig:
616
621
  """
617
622
  Create an Amazon Redshift table configuration.
618
-
623
+
619
624
  Args:
620
625
  name: Name of the table configuration
621
626
  host: Redshift cluster endpoint
@@ -628,7 +633,7 @@ class Table:
628
633
  replication_key: Column name to use for change data capture
629
634
  description: Optional description of the table
630
635
  ssl_args: Optional SSL configuration parameters
631
-
636
+
632
637
  Returns:
633
638
  RedshiftTableConfig: Configured Redshift table configuration
634
639
  """
@@ -648,11 +653,12 @@ class Table:
648
653
  kwargs.update(ssl_args)
649
654
  return RedshiftTableConfig(**kwargs)
650
655
 
656
+
651
657
  class View:
652
658
  """
653
659
  Factory methods for View configurations.
654
660
  """
655
-
661
+
656
662
  @staticmethod
657
663
  def SQL(
658
664
  name: str,
@@ -664,11 +670,15 @@ class View:
664
670
  Create a SQL view configuration.
665
671
  """
666
672
  transform_type = "MATERIALIZED_VIEW" if materialized else "VIEW"
667
-
673
+
668
674
  return SQLViewConfig(
669
675
  name=name,
670
676
  sql_query=query,
671
- sql_transform_type=SQLTransformType(transform_type) if isinstance(transform_type, str) else transform_type,
677
+ sql_transform_type=(
678
+ SQLTransformType(transform_type)
679
+ if isinstance(transform_type, str)
680
+ else transform_type
681
+ ),
672
682
  description=description,
673
683
  )
674
684