@@ -73,9 +73,8 @@ class FeatureView(BaseFeatureView):
7373 ttl: The amount of time this group of features lives. A ttl of 0 indicates that
7474 this group of features lives forever. Note that large ttl's or a ttl of 0
7575 can result in extremely computationally intensive queries.
76- batch_source: The batch source of data where this group of features
77- is stored. This is optional ONLY if a push source is specified as the
78- stream_source, since push sources contain their own batch sources.
76+ batch_source: Optional batch source of data where this group of features
77+ is stored. If no source is provided, this will be None.
7978 stream_source: The stream source of data where this group of features is stored.
8079 schema: The schema of the feature view, including feature, timestamp, and entity
8180 columns. If not specified, can be inferred from the underlying data source.
@@ -97,7 +96,7 @@ class FeatureView(BaseFeatureView):
9796 name : str
9897 entities : List [str ]
9998 ttl : Optional [timedelta ]
100- batch_source : DataSource
99+ batch_source : Optional [ DataSource ]
101100 stream_source : Optional [DataSource ]
102101 source_views : Optional [List ["FeatureView" ]]
103102 entity_columns : List [Field ]
@@ -115,7 +114,7 @@ def __init__(
115114 self ,
116115 * ,
117116 name : str ,
118- source : Union [DataSource , "FeatureView" , List ["FeatureView" ]],
117+ source : Optional [ Union [DataSource , "FeatureView" , List ["FeatureView" ]]] = None ,
119118 sink_source : Optional [DataSource ] = None ,
120119 schema : Optional [List [Field ]] = None ,
121120 entities : Optional [List [Entity ]] = None ,
@@ -133,8 +132,9 @@ def __init__(
133132
134133 Args:
135134 name: The unique name of the feature view.
136- source: The source of data for this group of features. May be a stream source, or a batch source.
137- If a stream source, the source should contain a batch_source for backfills & batch materialization.
135+ source (optional): The source of data for this group of features. May be a stream source,
136+ a batch source, a FeatureView, or a list of FeatureViews. If None, the feature view
137+ has no associated data source.
138138 schema (optional): The schema of the feature view, including feature, timestamp,
139139 and entity columns.
140140 # TODO: clarify that schema is only useful here...
@@ -170,7 +170,9 @@ def __init__(
170170 self .data_source : Optional [DataSource ] = None
171171 self .source_views : List [FeatureView ] = []
172172
173- if isinstance (source , DataSource ):
173+ if source is None :
174+ pass # data_source remains None, source_views remains []
175+ elif isinstance (source , DataSource ):
174176 self .data_source = source
175177 elif isinstance (source , FeatureView ):
176178 self .source_views = [source ]
@@ -199,11 +201,14 @@ def __init__(
199201 elif self .data_source :
200202 # Batch source definition
201203 self .batch_source = self .data_source
202- else :
204+ elif self . source_views :
203205 # Derived view source definition
204206 if not sink_source :
205207 raise ValueError ("Derived FeatureView must specify `sink_source`." )
206208 self .batch_source = sink_source
209+ else :
210+ # source=None - no batch source
211+ self .batch_source = None
207212
208213 # Initialize features and entity columns.
209214 features : List [Field ] = []
0 commit comments