Skip to content

Commit ae68e4d

Browse files
feat: Adding Click command to display configuration details (feast-dev#5036)
* Adding Click command to display configuration details Signed-off-by: ShaktidharK1997 <[email protected]> * Adding unit test for configuration CLI command and documentation for the same Signed-off-by: ShaktidharK1997 <[email protected]> --------- Signed-off-by: ShaktidharK1997 <[email protected]>
1 parent e14751a commit ae68e4d

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed

docs/reference/feast-cli-commands.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Options:
1919
2020
Commands:
2121
apply Create or update a feature store deployment
22+
configuration Display Feast configuration
2223
entities Access entities
2324
feature-views Access feature views
2425
init Create a new Feast repository
@@ -61,6 +62,28 @@ feast apply
6162
`feast apply` \(when configured to use cloud provider like `gcp` or `aws`\) will create cloud infrastructure. This may incur costs.
6263
{% endhint %}
6364

65+
## Configuration
66+
67+
Display the actual configuration being used by Feast, including both user-provided configurations and default configurations applied by Feast.
68+
69+
```bash
70+
feast configuration
71+
```
72+
73+
```yaml
74+
project: foo
75+
registry: data/registry.db
76+
provider: local
77+
online_store:
78+
type: sqlite
79+
path: data/online_store.db
80+
offline_store:
81+
type: dask
82+
entity_key_serialization_version: 2
83+
auth:
84+
type: no_auth
85+
```
86+
6487
## Entities
6588
6689
List all registered entities

sdk/python/feast/cli.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,24 @@ def version():
137137
print(f'Feast SDK Version: "{importlib_version("feast")}"')
138138

139139

140+
@cli.command()
141+
@click.pass_context
142+
def configuration(ctx: click.Context):
143+
"""
144+
Display Feast configuration
145+
"""
146+
repo = ctx.obj["CHDIR"]
147+
fs_yaml_file = ctx.obj["FS_YAML_FILE"]
148+
cli_check_repo(repo, fs_yaml_file)
149+
repo_config = load_repo_config(repo, fs_yaml_file)
150+
if repo_config:
151+
config_dict = repo_config.model_dump(by_alias=True, exclude_unset=True)
152+
config_dict.pop("repo_path", None)
153+
print(yaml.dump(config_dict, default_flow_style=False, sort_keys=False))
154+
else:
155+
print("No configuration found.")
156+
157+
140158
@cli.command()
141159
@click.option(
142160
"--host",

sdk/python/tests/unit/cli/test_cli.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,3 +170,23 @@ def setup_third_party_registry_store_repo(
170170
)
171171

172172
yield repo_path
173+
174+
175+
def test_cli_configuration():
176+
"""
177+
Unit test for the 'feast configuration' command
178+
"""
179+
runner = CliRunner()
180+
181+
with setup_third_party_provider_repo("local") as repo_path:
182+
# Run the 'feast configuration' command
183+
return_code, output = runner.run_with_output(["configuration"], cwd=repo_path)
184+
185+
# Assertions
186+
assertpy.assert_that(return_code).is_equal_to(0)
187+
assertpy.assert_that(output).contains(b"project: foo")
188+
assertpy.assert_that(output).contains(b"provider: local")
189+
assertpy.assert_that(output).contains(b"type: sqlite")
190+
assertpy.assert_that(output).contains(b"path: data/online_store.db")
191+
assertpy.assert_that(output).contains(b"type: file")
192+
assertpy.assert_that(output).contains(b"entity_key_serialization_version: 2")

0 commit comments

Comments
 (0)