tencent-wedata-feature-engineering-dev 0.1.40__py3-none-any.whl → 0.1.42__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: tencent-wedata-feature-engineering-dev
3
- Version: 0.1.40
3
+ Version: 0.1.42
4
4
  Summary: Wedata Feature Engineering Library Development
5
5
  Home-page:
6
6
  Author: meahqian
@@ -12,7 +12,7 @@ wedata/feature_store/common/protos/feature_store_pb2.py,sha256=oMIUGGeGNP84g_nFq
12
12
  wedata/feature_store/common/store_config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  wedata/feature_store/common/store_config/redis.py,sha256=9R5npM2s1u0o9IakmpbRsFdJC0vNar_uvA62OLWuXBs,1145
14
14
  wedata/feature_store/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- wedata/feature_store/constants/constants.py,sha256=kzelGSFVIj2druYso9jFjRSmOaWrj7A4EE83TRbw9xs,1959
15
+ wedata/feature_store/constants/constants.py,sha256=d4xnvPZeVKMFi8cYp6Ya9GdoUl9NQzyH4hIaXOgTWd4,1959
16
16
  wedata/feature_store/constants/engine_types.py,sha256=42mI-kNDDtoA4_I3iqDe4FkF2M2l_Bt4Q1V6WUB-_k0,921
17
17
  wedata/feature_store/entities/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  wedata/feature_store/entities/column_info.py,sha256=-AR6EKHwgoqIkRHFyguxVEtnYt6fvusWHkEjF4kvS0A,5141
@@ -30,16 +30,16 @@ wedata/feature_store/entities/on_demand_column_info.py,sha256=a44ep-f3FOruWNXl3c
30
30
  wedata/feature_store/entities/source_data_column_info.py,sha256=FyBmBPUSvc2S2OPFTvsQf2AdS-KFGkYBmd4yL_Vur8M,702
31
31
  wedata/feature_store/entities/training_set.py,sha256=ylt1h6Z_xU8hKYvnvd80CeewTGSN68-_kvFpoliwH7s,5679
32
32
  wedata/feature_store/feast_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- wedata/feature_store/feast_client/feast_client.py,sha256=nRk2XMmXaZOp-3PMYi-_ScxS4hXbJ_awDylu07T8L_s,20343
33
+ wedata/feature_store/feast_client/feast_client.py,sha256=TT1ESVYbP9kT5LyfYEYfnsM2mvOiJBug3527Y73lg3o,20694
34
34
  wedata/feature_store/feature_table_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
35
- wedata/feature_store/feature_table_client/feature_table_client.py,sha256=9NNhsYdLdlzeuOFDQW384EuDP-RHQAqbbCbOYUJKua4,41402
35
+ wedata/feature_store/feature_table_client/feature_table_client.py,sha256=wLawB-97ZJ4og5Y8f0VfRYsuygXY6DzMeorTTzdA9mM,41176
36
36
  wedata/feature_store/spark_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
- wedata/feature_store/spark_client/spark_client.py,sha256=B_6f_VVSdhft1SsoAohXCG08XnjokR3FgXql8cROtsI,11840
37
+ wedata/feature_store/spark_client/spark_client.py,sha256=ACWaRaDChqr2qAM8st6e0BP-LSEBSIj2xZAElX2nxHE,11799
38
38
  wedata/feature_store/training_set_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  wedata/feature_store/training_set_client/training_set_client.py,sha256=teaWM-xDgp2TwnadovUm0i4A26roTozgRefIZaHORko,23376
40
40
  wedata/feature_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- wedata/feature_store/utils/common_utils.py,sha256=BRIU4Qb8uvhe5E3fwBMY_Q7t7XTt-aNqEfhUsHjQnqQ,12371
42
- wedata/feature_store/utils/env_utils.py,sha256=72-KFPZ_L4SNthEZ-0ZH6ynNlmj0AboH5JnM1BVQoP8,2288
41
+ wedata/feature_store/utils/common_utils.py,sha256=vkpoXxZTd6S-2MgdyTQZ6P_ckdqNSK50ECuVBG2BwfI,12314
42
+ wedata/feature_store/utils/env_utils.py,sha256=ffDhQVW96vZxWurzOhYfZQk_dQ1LHC-y8tl4PQlp9Tg,2570
43
43
  wedata/feature_store/utils/feature_lookup_utils.py,sha256=mNV6RhBdpv1iTZduCA9YwXwkeJCwU5MFQ1MkFeD9IhY,22003
44
44
  wedata/feature_store/utils/feature_spec_utils.py,sha256=j8t-zel2_r8Q9m88BmFKkHMdkGNIduWJB-28OZDASRY,11613
45
45
  wedata/feature_store/utils/feature_utils.py,sha256=KKq28bVB_lCuhnR9Hk6JegJBOVgcelWlvrRM-F9onkA,2796
@@ -58,7 +58,7 @@ wedata/tempo/ml.py,sha256=WtGa2szn6PditvZsTZoxo7wFDe4k1SRoMZ-jgNGIjvE,4323
58
58
  wedata/tempo/resample.py,sha256=h81RVVmCl4ect-YKE-KZZHPDi1rGI3sh-YIb-Btz0ck,9698
59
59
  wedata/tempo/tsdf.py,sha256=S4lZfxhSRFiezYoYS6gvGsl1mZA3zp-MWEKFHYZpDg0,70968
60
60
  wedata/tempo/utils.py,sha256=I9I6l2DMwUoY213L04Yc1UR_zTWgSkj1BVo4ZwzQd4Y,7977
61
- tencent_wedata_feature_engineering_dev-0.1.40.dist-info/METADATA,sha256=xzoUceLzG0JG5B-c11dHf9tEB3Spdz9OF0kPlKSMHZk,582
62
- tencent_wedata_feature_engineering_dev-0.1.40.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
63
- tencent_wedata_feature_engineering_dev-0.1.40.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
64
- tencent_wedata_feature_engineering_dev-0.1.40.dist-info/RECORD,,
61
+ tencent_wedata_feature_engineering_dev-0.1.42.dist-info/METADATA,sha256=92FGxlFyakPGdx3bwUjkpmImzCl5eB_KxiYMU2yqc_8,582
62
+ tencent_wedata_feature_engineering_dev-0.1.42.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
63
+ tencent_wedata_feature_engineering_dev-0.1.42.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
64
+ tencent_wedata_feature_engineering_dev-0.1.42.dist-info/RECORD,,
@@ -43,7 +43,7 @@ ML_MODEL = "MLmodel"
43
43
  FEATURE_LOOKUP_CLIENT_PIP_PACKAGE = "tencent-wedata-feature-engineering-dev"
44
44
 
45
45
  # 特征查找版本号
46
- FEATURE_LOOKUP_CLIENT_MAJOR_VERSION = "0.1.40"
46
+ FEATURE_LOOKUP_CLIENT_MAJOR_VERSION = "0.1.42"
47
47
 
48
48
  # 特征存储内部数据目录
49
49
  FEATURE_STORE_INTERNAL_DATA_DIR = "_wedata_internal/"
@@ -7,7 +7,8 @@ Feast客户端,用于与Feast服务器交互
7
7
  import json
8
8
  import os
9
9
  import re
10
- from typing import List, Dict, Optional, Any
10
+ from datetime import datetime
11
+ from typing import List, Dict, Optional, Any, Tuple
11
12
  try:
12
13
  # pyspark 3.5.0 以后
13
14
  from pyspark.errors import IllegalArgumentException
@@ -97,6 +98,7 @@ class FeastClient:
97
98
  tags=tags,
98
99
  description=description
99
100
  )
101
+ # 确保feature在增量服务时获取的数据时间范围时正确的。
100
102
  self._apply_feature_view(table_name, entities, feature_view)
101
103
 
102
104
  def _apply_feature_view(self, table_name, entities, feature_view: FeatureView):
@@ -160,11 +162,10 @@ class FeastClient:
160
162
  raise ValueError(f"Table {table_name} not found in Feast")
161
163
 
162
164
  if self._client.config.online_store.type == "redis":
163
- print("redis table_view join_keys:", table_view.join_keys)
164
165
  redis_online_store = RedisOnlineStore()
165
166
  redis_online_store.delete_table(self._client.config, table_view)
166
167
  table_view.online = False
167
- table_view.materialization_intervals = []
168
+ table_view.update_materialization_intervals(get_materialization_default_time())
168
169
  self._client.apply(table_view)
169
170
  else:
170
171
  raise ValueError(f"Unsupported online store type: {self._client.config.online_store.type}")
@@ -361,6 +362,7 @@ def _create_table_to_feature_view(
361
362
  source=resources,
362
363
  )
363
364
  feature_view.online = False
365
+ feature_view.update_materialization_intervals([(datetime(1990, 1, 1), datetime(1990, 1, 1))])
364
366
  return feature_view
365
367
 
366
368
 
@@ -465,18 +467,22 @@ def translate_table_name_to_feast(table_name: str):
465
467
  raise ValueError(f"Invalid table name: {table_name}")
466
468
 
467
469
 
468
- if __name__ == '__main__':
469
- import datetime
470
- FeastClient = FeastClient()
471
- FeastClient.client.registry.delete_data_source(name="xxxxx")
472
- FeastClient.client.registry.delete_entity("xxxxx", )
473
- FeastClient.client.registry.delete_feature_view()
474
- FeastClient.client.registry.get_feature_view()
475
- FeastClient.client.registry.delete_feature_service()
476
- FeastClient.client.get_historical_features()
477
- feature_view = FeastClient.client.get_feature_view(name="xxxxx")
478
- feature_view.source.get_table_query_string()
479
- feast_table_name = "xxx"
480
- from wedata.feature_store.utils.common_utils import build_full_table_name
481
- feast_table_name = translate_table_name_to_feast(build_full_table_name(table_name, database_name))
482
- FeastClient.client.materialize(start_date=datetime.datetime(2021,1,1), end_date=datetime.datetime.now(), feature_views=[feast_table_name])
470
+ def get_materialization_default_time() -> List[Tuple[datetime, datetime]]:
471
+ return [(datetime(1990, 1, 1), datetime(1990, 1, 1))]
472
+
473
+
474
+ # if __name__ == '__main__':
475
+ # import datetime
476
+ # FeastClient = FeastClient()
477
+ # FeastClient.client.registry.delete_data_source(name="xxxxx")
478
+ # FeastClient.client.registry.delete_entity("xxxxx", )
479
+ # FeastClient.client.registry.delete_feature_view()
480
+ # FeastClient.client.registry.get_feature_view()
481
+ # FeastClient.client.registry.delete_feature_service()
482
+ # FeastClient.client.get_historical_features()
483
+ # feature_view = FeastClient.client.get_feature_view(name="xxxxx")
484
+ # feature_view.source.get_table_query_string()
485
+ # feast_table_name = "xxx"
486
+ # from wedata.feature_store.utils.common_utils import build_full_table_name
487
+ # feast_table_name = translate_table_name_to_feast(build_full_table_name(table_name, database_name))
488
+ # FeastClient.client.materialize(start_date=datetime.datetime(2021,1,1), end_date=datetime.datetime.now(), feature_views=[feast_table_name])
@@ -881,27 +881,22 @@ class FeatureTableClient:
881
881
  online_feature_config.DB = online_config.db
882
882
 
883
883
  offline_feature_config = OfflineFeatureConfiguration()
884
- offline_feature_config.DatabaseName = database_name if database_name else os.environ.get(
885
- "WEDATA_DEFAULT_FEATURE_STORE_DATABASE")
884
+ offline_feature_config.DatabaseName = env_utils.get_database_name(database_name)
886
885
  offline_feature_config.TableName = table_name
887
886
 
888
887
  offline_feature_config.PrimaryKeys, offline_feature_config.TimestampColumn = self._get_table_primary_keys_and_timestamp_key(
889
888
  full_table_name)
890
889
 
891
890
  offline_feature_config.DatasourceName = data_source_name
892
- offline_feature_config.DatasourceType = "DLC" if os.environ.get("DLC_REGION") else "EMR"
893
- offline_feature_config.EngineName = os.environ.get("KERNEL_ENGINE")
891
+ offline_feature_config.DatasourceType = env_utils.get_engine_type()
892
+ offline_feature_config.EngineName = env_utils.get_engine_name()
894
893
 
895
894
  api_requests = CreateOnlineFeatureTableRequest()
896
895
  api_requests.OfflineFeatureConfiguration = offline_feature_config
897
896
  api_requests.OnlineFeatureConfiguration = online_feature_config
898
897
  api_requests.TaskSchedulerConfiguration = cycle_obj
899
- api_requests.ProjectId = os.environ.get("WEDATA_PROJECT_ID")
900
- if offline_feature_config.DatasourceType == "DLC":
901
- region = os.environ.get("DLC_REGION")
902
- else:
903
- region = os.environ.get("EMR_REGION")
904
-
898
+ api_requests.ProjectId = env_utils.get_project_id()
899
+ region = env_utils.get_region()
905
900
  if not os.environ.get("RESOURCE_GROUP_ID", ""):
906
901
  res_group_item = _get_default_resource_group(
907
902
  api_requests.ProjectId, cloud_secret_id, cloud_secret_key, region)
@@ -962,7 +957,7 @@ def _refresh_table(project_id: str, secret_id: str, secret_key: str, region: str
962
957
  request.DatasourceName = data_source_name
963
958
  request.DatasourceType = data_source_type
964
959
  request.EngineName = engine_name
965
- request.Action = action
960
+ request.ActionName = action
966
961
  request.IsTry = is_try
967
962
  resp = client.RefreshFeatureTable(request)
968
963
  return resp
@@ -30,7 +30,6 @@ class SparkClient:
30
30
  str: 当前catalog名称,如果未设置则返回None
31
31
  """
32
32
  _, ok, _ = check_package_version("pyspark", "3.4.0", ">=")
33
- print(f"pyspark >= 3.4.0 {ok}")
34
33
  if ok:
35
34
  return unsanitize_identifier(self._spark.catalog.currentCatalog())
36
35
  else:
@@ -348,5 +348,4 @@ def check_spark_table_exists(spark_client: SparkSession, full_table_name: str) -
348
348
  query = f"SHOW TABLES IN {split[1]} LIKE '{split[2]}'"
349
349
  else:
350
350
  query = f"SHOW TABLES LIKE '{full_table_name}'"
351
- logging.debug("check table sql: =======", query)
352
351
  return spark_client.sql(query).count() > 0
@@ -72,9 +72,19 @@ def get_engine_name() -> str:
72
72
  """
73
73
  获取引擎名称
74
74
  """
75
- engine_name = os.environ.get("KERNEL_ENGINE")
75
+ engine_name = os.environ.get("KERNEL_ENGINE_NAME")
76
76
  if engine_name:
77
77
  return engine_name
78
+ raise EnvironmentError("environment variable KERNEL_ENGINE_NAME is not set, please check environment configuration")
79
+
80
+
81
+ def get_engine_id() -> str:
82
+ """
83
+ 获取引擎ID
84
+ """
85
+ engine_id = os.environ.get("KERNEL_ENGINE")
86
+ if engine_id:
87
+ return engine_id
78
88
  raise EnvironmentError("environment variable KERNEL_ENGINE is not set, please check environment configuration")
79
89
 
80
90