Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
SparkSessionSingleton
✓ from sparkorm import SparkSessionSingleton
✗ from sparkorm import SparkSessionSingleton
Define a schema model, create a SparkDataFrame, and display it.
from sparkorm import SparkSessionSingleton, SparkDataFrame, Structure
from pyspark.sql.types import StructType, StructField, StringType, IntegerType
# Define schema model
class Employee(Structure):
name: str
age: int
# Get or create SparkSession
spark = SparkSessionSingleton().get_or_create()
# Create sample data
rows = [("Alice", 30), ("Bob", 25)]
schema = StructType([
StructField("name", StringType(), True),
StructField("age", IntegerType(), True)
])
df = spark.createDataFrame(rows, schema)
# Wrap with SparkDataFrame
sdf = SparkDataFrame(df, Employee)
sdf.show()
Upgrade
Version history
1.2.29latest on PyPI · released Jun 24, 2024
Audit
Dependencies
pysparkrequiredRequired for Spark interaction; must be installed separately.