Skip to content

Commit

Permalink
fix view update
Browse files Browse the repository at this point in the history
  • Loading branch information
rymarczy committed Jan 3, 2024
1 parent 695cca6 commit 2c18a39
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions python_src/src/lamp_py/tableau/jobs/gtfs_rail.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def __init__(
self,
gtfs_table_name: str,
table_query: str,
always_create_parquet: bool = False,
) -> None:
HyperJob.__init__(
self,
Expand All @@ -31,6 +32,7 @@ def __init__(
self.gtfs_table_name = gtfs_table_name
self.create_query = table_query % ""
self.update_query = table_query
self.always_create_parquet = always_create_parquet

@property
def parquet_schema(self) -> pyarrow.schema:
Expand Down Expand Up @@ -69,6 +71,10 @@ def update_parquet(self, db_manager: DatabaseManager) -> bool:
if max_db_key <= max_parquet_key:
return False

if self.always_create_parquet:
self.create_parquet(db_manager)
return True

# add WHERE clause to UPDATE query
update_query = self.update_query % (
f" WHERE static_version_key > {max_parquet_key} ",
Expand Down Expand Up @@ -120,6 +126,7 @@ def __init__(self) -> None:
"%s"
"ORDER BY static_version_key, service_id, service_date"
),
always_create_parquet=True,
)

@property
Expand Down

0 comments on commit 2c18a39

Please sign in to comment.