staran 0.2.1__tar.gz → 0.2.2__tar.gz

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.4
2
2
  Name: staran
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: staran - 高性能Python工具库
5
5
  Home-page: https://github.com/starlxa/staran
6
6
  Author: StarAn
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='staran',
5
- version='0.2.1',
5
+ version='0.2.2',
6
6
  description='staran - 高性能Python工具库',
7
7
  long_description=open('README.md', encoding='utf-8').read(),
8
8
  long_description_content_type='text/markdown',
@@ -36,7 +36,10 @@ Date工具基本用法::
36
36
 
37
37
  SQL工具基本用法::
38
38
 
39
- from staran import TableSchema, FeatureGenerator
39
+ from staran import TableSchema, FeatureGenerator, SQLManager, DatabaseType
40
+
41
+ # 创建SQL管理器
42
+ sql_manager = SQLManager('my_database', DatabaseType.SPARK)
40
43
 
41
44
  # 定义表结构
42
45
  schema = TableSchema('user_behavior')
@@ -46,10 +49,27 @@ SQL工具基本用法::
46
49
  schema.add_field('status', 'string')
47
50
  schema.set_monthly_unique(True)
48
51
 
49
- # 生成特征SQL
50
- generator = FeatureGenerator(schema)
51
- sql = generator.generate_spark_sql()
52
- print(sql)
52
+ # 创建特征生成器
53
+ generator = FeatureGenerator(schema, sql_manager)
54
+
55
+ # 按类型生成特征表
56
+ table_name = generator.create_feature_table('aggregation', 2025, 7, 1)
57
+ print(f"生成特征表: {table_name}")
58
+
59
+ 特征类型控制::
60
+
61
+ from staran.sql import FeatureConfig, FeatureType
62
+
63
+ # 配置只生成基础特征
64
+ config = FeatureConfig()
65
+ config.enable_feature(FeatureType.MOM) # 启用环比特征
66
+ config.set_mom_periods([1]) # 只生成1个月环比
67
+
68
+ generator = FeatureGenerator(schema, sql_manager, config)
69
+
70
+ # 分别生成不同类型的特征表
71
+ agg_table = generator.create_feature_table('aggregation', 2025, 7, 1)
72
+ mom_table = generator.create_feature_table('mom', 2025, 7, 2)
53
73
 
54
74
  多种输出格式::
55
75
 
@@ -132,14 +152,16 @@ SQL工具:
132
152
 
133
153
  # 导入主要功能
134
154
  from .tools import Date
135
- from .sql import TableSchema, FeatureGenerator, SparkSQLGenerator
155
+ from .sql import TableSchema, FeatureGenerator, SparkSQLGenerator, SQLManager, DatabaseType
136
156
 
137
157
  # 主要导出
138
158
  __all__ = [
139
159
  'Date',
140
160
  'TableSchema',
141
161
  'FeatureGenerator',
142
- 'SparkSQLGenerator'
162
+ 'SparkSQLGenerator',
163
+ 'SQLManager',
164
+ 'DatabaseType'
143
165
  ]
144
166
 
145
167
  # 包信息
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staran
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: staran - 高性能Python工具库
5
5
  Home-page: https://github.com/starlxa/staran
6
6
  Author: StarAn
File without changes
File without changes
File without changes
File without changes
File without changes