Registry / aws / sagemaker-feature-store-pyspark-3-1

sagemaker-feature-store-pyspark-3-1

JSON →
library1.1.3pypypi✓ verified 22d ago

Amazon SageMaker FeatureStore PySpark Bindings provide a Spark Datasource to read data from SageMaker Feature Store and a Spark Processor to write data to SageMaker Feature Store. This package is specifically designed for Spark 3.1 environments, enabling users to interact with SageMaker Feature Store directly from Spark jobs. The current version is 1.1.3, with updates released as needed for new features or compatibility.

pip install sagemaker-feature-store-pyspark-3-1
INSTALL
IMPORT
SIG · SAGEMAKER-FEATURE-
S
sagemaker-feature-store-pyspark-3-1
awspythonv1.1.3
Install
5.5s avg
Import
Disk
72MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 74.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 5.5s · import 0.000s · 75MB
72MB installed
● package 72MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

FeatureStoreManager
from feature_store_pyspark import FeatureStoreManager
from sagemaker_featurestore_pyspark import FeatureStoreManager

Demonstrates how to initialize the FeatureStoreManager and read data from a SageMaker Feature Group using PySpark. For local execution, ensure your SparkSession is configured with the correct JAR package.

import os from pyspark.sql import SparkSession from sagemaker_featurestore_pyspark import FeatureStoreManager # IMPORTANT: For local PySpark execution, you MUST include the spark.jars.packages config. # Replace '1.1.3' with the exact version of the sagemaker-featurestore-pyspark-sdk you are using. # Ensure PySpark and Java are installed and configured for your environment. spark = SparkSession.builder \ .appName("FeatureStorePySparkQuickstart") \ .config("spark.jars.packages", "software.amazon.sagemaker:sagemaker-featurestore-pyspark-sdk:1.1.3") \ .getOrCreate() # Replace with your actual Feature Group name and AWS region feature_group_name = os.environ.get('SAGEMAKER_FEATURE_GROUP_NAME', 'your-feature-group-name') aws_region = os.environ.get('AWS_REGION', 'us-east-1') # Initialize FeatureStoreManager # AWS credentials are typically sourced from the Spark environment (IAM Role, AWS_ACCESS_KEY_ID/SECRET_ACCESS_KEY). fs_manager = FeatureStoreManager(spark_session=spark, region=aws_region) try: # Read data from the Feature Group's online store df = fs_manager.read_feature_group( feature_group_name=feature_group_name ) print(f"Successfully read data from Feature Group: {feature_group_name}") df.show(5) df.printSchema() except Exception as e: print(f"Error interacting with Feature Group {feature_group_name}: {e}") print("Troubleshooting: Ensure Feature Group exists, credentials are set, and Spark environment is configured (esp. 'spark.jars.packages').") finally: spark.stop()
Debug
Known issues
breakingThis library is specifically compiled against Spark 3.1 and AWS SDK for Java 2.17. Using it with significantly different Spark or Java SDK versions may lead to runtime errors or unexpected behavior.
fix
Ensure your Spark environment (e.g., EMR, Glue, local PySpark setup) is running Spark 3.1.x.
affects: All versions of sagemaker-feature-store-pyspark-3-1
gotchaIncorrect IAM permissions are a common cause of errors when interacting with AWS SageMaker Feature Store. Your Spark environment's IAM role or configured credentials must have `sagemaker:GetRecord`, `sagemaker:PutRecord`, and other necessary permissions for the Feature Groups.
fix
Verify that the IAM role or user associated with your Spark job has the required SageMaker Feature Store permissions.
affects: All versions
gotchaWhen running PySpark locally or on custom clusters, the necessary Java JARs for the SageMaker Feature Store SDK must be explicitly configured in the SparkSession via `spark.jars.packages` to avoid `ClassNotFoundException` errors.
fix
Include `.config('spark.jars.packages', 'software.amazon.sagemaker:sagemaker-featurestore-pyspark-sdk:<VERSION>')` in your `SparkSession.builder` for local/custom setups.
affects: All versions
Upgrade
Version history
1.1.3latest on PyPI · released Feb 6, 2025
Audit
Dependencies
pysparkrequiredRequired for all Spark functionalities; the library targets PySpark 3.1.
Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
2
Resources
sagemaker-feature-store-pyspark-3-1 — pip install sagemaker-feature-store-pyspark-3-1 · libregistry