Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/lamp_py/ingestion/config_rt_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
import pyarrow

from lamp_py.ingestion.gtfs_rt_detail import GTFSRTDetail
from lamp_py.ingestion.gtfs_rt_structs import (
trip_descriptor,
vehicle_descriptor,
stop_time_event,
)
from lamp_py.ingestion.gtfs_rt_structs import trip_descriptor, vehicle_descriptor, stop_time_event, trip_properties
from lamp_py.ingestion.utils import explode_table_column, flatten_table_schema


Expand All @@ -17,7 +13,7 @@ class RtTripDetail(GTFSRTDetail):
"""

def transform_for_write(self, table: pyarrow.table) -> pyarrow.table:
"""modify table schema before write to parquet"""
"""Modify table schema before write to parquet"""
return flatten_table_schema(explode_table_column(flatten_table_schema(table), "trip_update.stop_time_update"))

@property
Expand Down Expand Up @@ -56,6 +52,7 @@ def import_schema(self) -> pyarrow.schema:
)
),
),
("trip_properties", trip_properties.pyarrow_dtype),
("timestamp", pyarrow.uint64()),
("delay", pyarrow.int32()),
]
Expand Down
2 changes: 2 additions & 0 deletions src/lamp_py/ingestion/gtfs_rt_structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@
"uncertainty": dy.Int32(nullable=True),
},
)

trip_properties = dy.Struct(inner={"trip_headsign": dy.String(nullable=True)})
Binary file modified tests/test_files/ingestion_GTFS-RT_TU.parquet
Binary file not shown.
Binary file modified tests/test_files/ingestion_GTFS-RT_TU_OLD.parquet
Binary file not shown.
Loading