Feast version 0.21
Hive table structure :
event_timestamp timestamp
driver_id bigint
conv_rate float
acc_rate float
avg_daily_trips int
created timestamp
Example.py
from google.protobuf.duration_pb2 import Duration
from feast import Entity, Feature, FeatureView, ValueType
from feast_hive import HiveSource
driver_hourly_stats = HiveSource(
# table='driver_stats',
query = """
SELECT event_timestamp,
driver_id, conv_rate, acc_rate, avg_daily_trips,
created
FROM feast_offline_store.driver_stats
""",
event_timestamp_column="event_timestamp",
created_timestamp_column="created",
)
Define an entity for the driver.
driver = Entity(name="driver_id", value_type=ValueType.INT64, description="driver id", )
Define FeatureView
driver_hourly_stats_view = FeatureView(
name="driver_hourly_stats",
entities=["driver_id"],
ttl=Duration(seconds=86400 * 1),
features=[
Feature(name="conv_rate", dtype=ValueType.FLOAT),
Feature(name="acc_rate", dtype=ValueType.FLOAT),
Feature(name="avg_daily_trips", dtype=ValueType.INT64),
],
online=True,
batch_source=driver_hourly_stats,
tags={},
)
Feast Apply error stack trace
cdsw@7wp2regwjxlve0wz:~/feature_repo$ feast apply
Traceback (most recent call last):
File "/home/cdsw/.local/bin/feast", line 8, in
sys.exit(cli())
File "/opt/cmladdons/python/site-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/opt/cmladdons/python/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/opt/cmladdons/python/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/opt/cmladdons/python/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/opt/cmladdons/python/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/opt/cmladdons/python/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/cli.py", line 489, in apply_total_command
apply_total(repo_config, repo, skip_source_validation)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/usage.py", line 280, in wrapper
raise exc.with_traceback(traceback)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/usage.py", line 269, in wrapper
return func(*args, **kwargs)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/repo_operations.py", line 275, in apply_total
project, registry, repo, store = _prepare_registry_and_repo(repo_config,repo_path)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/repo_operations.py", line 183, in _prepare_registry_and_repo
repo = parse_repo(repo_path)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast/repo_operations.py", line 116, in parse_repo
module = importlib.import_module(module_path)
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 967, in _find_and_load_unlocked
File "", line 677, in _load_unlocked
File "", line 728, in exec_module
File "", line 219, in _call_with_frames_removed
File "/home/cdsw/feature_repo/example.py", line 28, in
driver_hourly_stats = HiveSource(table=None,query=my_query,event_timestamp_column="event_timestamp",created_timestamp_column="created",field_mapping=None,date_partition_column="",)
File "/home/cdsw/.local/lib/python3.7/site-packages/feast_hive/hive_source.py", line 98, in init
date_partition_column,
TypeError: init() takes 1 positional argument but 5 were given