Title: Python SDK get_historical_features does not use field mappings. · Issue #2248 · feast-dev/feast · GitHub
Open Graph Title: Python SDK get_historical_features does not use field mappings. · Issue #2248 · feast-dev/feast
X Title: Python SDK get_historical_features does not use field mappings. · Issue #2248 · feast-dev/feast
Description: Expected Behavior When setting a field mapping for offline data sources such as {"column_name": "feature_name"}, I would expect to call get_historical_features(features=["feature_name"]) and get back a dataframe with this feature_name as...
Open Graph Description: Expected Behavior When setting a field mapping for offline data sources such as {"column_name": "feature_name"}, I would expect to call get_historical_features(features=["feature_name"]) and get ba...
X Description: Expected Behavior When setting a field mapping for offline data sources such as {"column_name": "feature_name"}, I would expect to call get_historical_features(features=["f...
Opengraph URL: https://github.com/feast-dev/feast/issues/2248
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Python SDK get_historical_features does not use field mappings.","articleBody":"## Expected Behavior \r\n\r\nWhen setting a field mapping for offline data sources such as `{\"column_name\": \"feature_name\"}`, I would expect to call `get_historical_features(features=[\"feature_name\"])` and get back a dataframe with this `feature_name` as a column.\r\n\r\n## Current Behavior\r\n\r\n- File data source: works as expected.\r\n- Bigquery data source: `google.api_core.exceptions.BadRequest: 400 Unrecognized name: feature_name at [581:13]`\r\n- Redshfit data source: `Redshift SQL Query failed to finish. Details: ... 'Error': 'ERROR: column \"feature_name\" does not exist`\r\n\r\n## Steps to reproduce\r\n\r\nWithin the [fraud detection tutorial](https://docs.feast.dev/tutorials/fraud-detection), update the `fraud_features.py` to use a field mapping in the `user_transaction_count_7d` feature view:\r\n\r\n```\r\ndriver_stats_fv = FeatureView(\r\n name=\"user_transaction_count_7d\",\r\n entities=[\"user_id\"],\r\n ttl=timedelta(weeks=1),\r\n batch_source=BigQuerySource(\r\n table_ref=f\"{PROJECT_ID}.{BIGQUERY_DATASET_NAME}.user_count_transactions_7d\",\r\n event_timestamp_column=\"feature_timestamp\",\r\n field_mapping={{\"transaction_count_7d\": \"transaction_count_7d_fm\"}}))\r\n```\r\n\r\nwhen calling `get_historical_features` you get an error that this column doesn't exist.\r\n\r\n```\r\ntraining_data = store.get_historical_features(\r\n entity_df=f\"\"\"\r\n select \r\n src_account as user_id,\r\n timestamp,\r\n is_fraud\r\n from\r\n feast-oss.fraud_tutorial.transactions\r\n where\r\n timestamp between timestamp('{two_days_ago.isoformat()}') \r\n and timestamp('{now.isoformat()}')\"\"\",\r\n features=[\r\n \"user_transaction_count_7d:transaction_count_7d_fm\",\r\n \"user_account_features:credit_score\",\r\n \"user_account_features:account_age_days\",\r\n \"user_account_features:user_has_2fa_installed\",\r\n \"user_has_fraudulent_transactions:user_has_fraudulent_transactions_7d\"\r\n ],\r\n full_feature_names=True\r\n).to_df()\r\n\r\ntraining_data.head()\r\n\r\n> BadRequest: 400 Unrecognized name: transaction_count_7d_fm; Did you mean transaction_count_7d? at [77:13]\r\n```\r\n\r\nNote, the materialize step handles the field mapping appropriately, and `get_online_features` works as expected.\r\n\r\n```\r\nfeature_vector = store.get_online_features(\r\n features=[\r\n \"user_transaction_count_7d:transaction_count_7d_fm\",\r\n \"user_account_features:credit_score\",\r\n \"user_account_features:account_age_days\",\r\n \"user_account_features:user_has_2fa_installed\",\r\n \"user_has_fraudulent_transactions:user_has_fraudulent_transactions_7d\"\r\n ],\r\n entity_rows=entity_rows\r\n ).to_dict()\r\n\r\n> {'credit_score': [480], 'account_age_days': [655], 'user_has_2fa_installed': [1], 'transaction_count_7d_fm': [6], 'user_has_fraudulent_transactions_7d': [0.0]}\r\n```\r\n\r\n### Specifications\r\n\r\n- Version: 0.17\r\n- Platform: Any\r\n- Subsystem:\r\n\r\n## Possible Solution\r\n\r\nUpdate data sources to query from the column name and return the mapped feature name.\r\n","author":{"url":"https://github.com/michelle-rascati-sp","@type":"Person","name":"michelle-rascati-sp"},"datePublished":"2022-01-27T19:35:21Z","url":"https://github.com/feast-dev/feast/issues/2248"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bf2482a4-4d9f-27f1-ecad-ed5311e86dfd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B96E:2DC43A:117D854:17544DB:6AFEABC2 |
| html-safe-nonce | a973a766858228e6e802187874d8396856eea025f271627e0b70521411a98d23 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTZFOjJEQzQzQToxMTdEODU0OjE3NTQ0REI6NkFGRUFCQzIiLCJ2aXNpdG9yX2lkIjoiMzczMTA2MjMxOTc0MDc5MTc0NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 73ab326e6df8678b92573079f3ff054afe4ad7f8e6ee50ed2de59f91ed0a1742 |
| hovercard-subject-tag | issue:1116663535 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/feast-dev/feast/2248/issue_layout |
| twitter:image | https://opengraph.githubassets.com/14627cd97e8cb4a9a1ee5ab34a0cf850c2985c4a341577fec160767ede6adacc/feast-dev/feast/issues/2248 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/14627cd97e8cb4a9a1ee5ab34a0cf850c2985c4a341577fec160767ede6adacc/feast-dev/feast/issues/2248 |
| og:image:alt | Expected Behavior When setting a field mapping for offline data sources such as {"column_name": "feature_name"}, I would expect to call get_historical_features(features=["feature_name"]) and get ba... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | michelle-rascati-sp |
| hostname | github.com |
| expected-hostname | github.com |
| None | 95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e |
| turbo-cache-control | no-preview |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3f25273206cd841171bca0002261ae4c9757d934 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width