wedata-feature-engineering 0.1.9__py3-none-any.whl → 0.1.11__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.
wedata/__init__.py CHANGED
@@ -3,4 +3,4 @@ WeData Feature Engineering
3
3
  A toolkit for automated feature engineering
4
4
  """
5
5
 
6
- __version__ = "0.1.9"
6
+ __version__ = "0.1.11"
@@ -113,7 +113,7 @@ class FeatureTableClient:
113
113
  try:
114
114
  if self._spark.catalog.tableExists(table_name):
115
115
  raise ValueError(
116
- f"Table '{table_name}' already exists\n"
116
+ f"Table '{name}' already exists\n"
117
117
  "Solutions:\n"
118
118
  "1. Use a different table name\n"
119
119
  "2. Drop the existing table: spark.sql(f'DROP TABLE {name}')\n"
@@ -125,11 +125,6 @@ class FeatureTableClient:
125
125
  table_schema = schema or df.schema
126
126
 
127
127
  # 构建时间戳键属性
128
- timestamp_keys_ddl = []
129
- for timestamp_key in timestamp_keys:
130
- if timestamp_key not in primary_keys:
131
- raise ValueError(f"Timestamp key '{timestamp_key}' must be a primary key")
132
- timestamp_keys_ddl.append(f"`{timestamp_key}` TIMESTAMP")
133
128
 
134
129
  #从环境变量获取额外标签
135
130
  env_tags = {
@@ -142,6 +137,7 @@ class FeatureTableClient:
142
137
  tbl_properties = {
143
138
  "feature_table": "TRUE",
144
139
  "primaryKeys": ",".join(primary_keys),
140
+ "timestampKeys": ",".join(timestamp_keys) if timestamp_keys else "",
145
141
  "comment": description or "",
146
142
  **{f"{k}": v for k, v in (tags or {}).items()},
147
143
  **{f"feature_{k}": v for k, v in (env_tags or {}).items()}
@@ -293,13 +289,13 @@ class FeatureTableClient:
293
289
  try:
294
290
  # 检查表是否存在
295
291
  if not self._spark.catalog.tableExists(table_name):
296
- raise ValueError(f" '{table_name}' 不存在")
292
+ raise ValueError(f"Table '{name}' does not exist")
297
293
 
298
294
  # 读取表数据
299
295
  return self._spark.read.table(table_name)
300
296
 
301
297
  except Exception as e:
302
- raise ValueError(f"读取表 '{table_name}' 失败: {str(e)}") from e
298
+ raise ValueError(f"Failed to read table '{name}': {str(e)}") from e
303
299
 
304
300
  def drop_table(self, name: str):
305
301
 
@@ -327,15 +323,17 @@ class FeatureTableClient:
327
323
  try:
328
324
  # 检查表是否存在
329
325
  if not self._spark.catalog.tableExists(table_name):
330
- raise ValueError(f" '{table_name}' 不存在")
326
+ print(f"Table '{name}' does not exist")
327
+ return
331
328
 
332
329
  # 执行删除
333
330
  self._spark.sql(f"DROP TABLE {table_name}")
331
+ print(f"Table '{name}' dropped")
334
332
 
335
333
  except ValueError as e:
336
334
  raise # 直接抛出已知的ValueError
337
335
  except Exception as e:
338
- raise RuntimeError(f"删除表 '{table_name}' 失败: {str(e)}") from e
336
+ raise RuntimeError(f"Failed to delete table '{name}': {str(e)}") from e
339
337
 
340
338
  def get_table(
341
339
  self,
@@ -357,12 +355,12 @@ class FeatureTableClient:
357
355
  """
358
356
 
359
357
  # 表名校验
360
- common_utils.validate_table_name(name)
358
+ # common_utils.validate_table_name(name)
361
359
 
362
360
  # 构建完整表名
363
- table_name = common_utils.build_full_table_name(name)
361
+ # table_name = common_utils.build_full_table_name(name)
364
362
 
365
363
  try:
366
- return spark_client.get_feature_table(table_name)
364
+ return spark_client.get_feature_table("")
367
365
  except Exception as e:
368
- raise ValueError(f"获取表'{table_name}'元数据失败: {str(e)}") from e
366
+ raise ValueError(f"Failed to get metadata for table '{table_name}': {str(e)}") from e
@@ -134,7 +134,13 @@ class SparkClient:
134
134
  for row in table_details:
135
135
  if row.col_name == "Table Properties":
136
136
  props = row.data_type[1:-1].split(", ")
137
- table_properties = dict(p.split("=") for p in props if "=" in p)
137
+ table_properties = {}
138
+ for p in props:
139
+ if "=" in p:
140
+ parts = p.split("=", 1)
141
+ key = parts[0].strip()
142
+ value = parts[1].strip() if len(parts) > 1 else ""
143
+ table_properties[key] = value
138
144
 
139
145
  # 获取特征列信息
140
146
  features = self.get_features(table_name)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wedata-feature-engineering
3
- Version: 0.1.9
3
+ Version: 0.1.11
4
4
  Summary: Wedata Feature Engineering Library
5
5
  Home-page:
6
6
  Author: meahqian
@@ -1,4 +1,4 @@
1
- wedata/__init__.py,sha256=QDgjssRv3Fu3e8OTEm5m1qWnkzAdYKW5vMtvkocJCmI,101
1
+ wedata/__init__.py,sha256=0uzKbLSDTIdIqSYIyqxfUzYvr7Wc1D0OFrXz-PsEv4c,102
2
2
  wedata/feature_store/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  wedata/feature_store/client.py,sha256=DO68yHiaJQ3LmrZ-owWEuRjuwM6vUjcaEdAcF65mdhs,8271
4
4
  wedata/feature_store/constants/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -20,9 +20,9 @@ wedata/feature_store/entities/on_demand_column_info.py,sha256=Eh5ieaj1TxC7DG6ipB
20
20
  wedata/feature_store/entities/source_data_column_info.py,sha256=a9jQOJvehwDIrKPwsP6W9YRBSPNK2nZYypE6-p80CwA,542
21
21
  wedata/feature_store/entities/training_set.py,sha256=ylt1h6Z_xU8hKYvnvd80CeewTGSN68-_kvFpoliwH7s,5679
22
22
  wedata/feature_store/feature_table_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- wedata/feature_store/feature_table_client/feature_table_client.py,sha256=tsVPB3IZIsfGxPd_kQna9b20zY494wuzLofv2j1w-so,12142
23
+ wedata/feature_store/feature_table_client/feature_table_client.py,sha256=-bRqWSKqXKc9888cwoDjWIJB1chv5FyC6xw1suIu_8I,11991
24
24
  wedata/feature_store/spark_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
- wedata/feature_store/spark_client/spark_client.py,sha256=SwMf-TsAeV7_8pDmh4927pKEwwKcIFK3JJ-J8rzUp_Q,10129
25
+ wedata/feature_store/spark_client/spark_client.py,sha256=bDhOjTzXZqOOhr-QQju8CfUbvW5Vc39LYAG3IaQ-0bU,10375
26
26
  wedata/feature_store/training_set_client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  wedata/feature_store/training_set_client/training_set_client.py,sha256=CVcdgqfHL2S-fSCkfDwQgqtMhkB8haGEi1kEjbudDOk,15087
28
28
  wedata/feature_store/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -37,7 +37,7 @@ wedata/feature_store/utils/topological_sort.py,sha256=ebzKxmxeCLk9seB1zR0ASCGXsZ
37
37
  wedata/feature_store/utils/training_set_utils.py,sha256=MYsPZS1d9HKswHgjgxD8K7H9N3dWPyyTTx20Mkp4PVU,22497
38
38
  wedata/feature_store/utils/uc_utils.py,sha256=A-W8Cd8yvTmAMEWaHeWmGmcIDMvUtjAfx2G2x_di1QE,10774
39
39
  wedata/feature_store/utils/validation_utils.py,sha256=FslvrNs3kstqvM6THScLOluEE6O9RWlDrD9xiihTzlw,1735
40
- wedata_feature_engineering-0.1.9.dist-info/METADATA,sha256=u_UnAZHKL603djFWLyfvZDIL220cwLEwyjYLjjXKRbw,644
41
- wedata_feature_engineering-0.1.9.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
42
- wedata_feature_engineering-0.1.9.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
43
- wedata_feature_engineering-0.1.9.dist-info/RECORD,,
40
+ wedata_feature_engineering-0.1.11.dist-info/METADATA,sha256=rB1KhKtpG6eQsShvCM8x1gIGBBM81GSu8QWyulXPgd0,645
41
+ wedata_feature_engineering-0.1.11.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
42
+ wedata_feature_engineering-0.1.11.dist-info/top_level.txt,sha256=Xa0v1rh__RvfVTVDirW5r5UBKg7ZO_iuTeXfp8MNo2A,7
43
+ wedata_feature_engineering-0.1.11.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (79.0.0)
2
+ Generator: setuptools (79.0.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5