Skip to content

Commit b7e40f8

Browse files
modify event type column
Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com>
1 parent de98803 commit b7e40f8

7 files changed

Lines changed: 21 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
## [Unreleased](https://github.com/MarquezProject/marquez/compare/0.42.0...HEAD)
44

55
### Added
6+
* API: support `DatasetEvent` [`#2641`](https://github.com/MarquezProject/marquez/pull/2641) [@pawel-big-lebowski]( https://github.com/pawel-big-lebowski)
7+
*Save into Marquez model datasets sent via `DatasetEvent` event type
68
* API: support `JobEvent` [`#2661`](https://github.com/MarquezProject/marquez/pull/2661) [@pawel-big-lebowski]( https://github.com/pawel-big-lebowski)
79
*Save into Marquez model jobs and datasets sent via `JobEvent` event type.
810

@@ -30,10 +32,6 @@
3032
* Web: fix Unix epoch time display for null `endedAt` values [`#2647`](https://github.com/MarquezProject/marquez/pull/2647) [@merobi-hub](https://github.com/merobi-hub)
3133
*Fixes the issue of the GUI displaying Unix epoch time (midnight on January 1, 1970) in the case of running jobs/null `endedAt` values.*
3234

33-
### Added
34-
* API: support `DatasetEvent` [`#2641`](https://github.com/MarquezProject/marquez/pull/2641) [@pawel-big-lebowski]( https://github.com/pawel-big-lebowski)
35-
*Save into Marquez model datasets sent via `DatasetEvent` event type
36-
3735
## [0.41.0](https://github.com/MarquezProject/marquez/compare/0.40.0...0.41.0) - 2023-09-20
3836
### Added
3937
* API: add support for the following parameters in the `SearchDao` [`#2556`](https://github.com/MarquezProject/marquez/pull/2556) [@tati](https://github.com/tati) [@wslulciuc](https://github.com/wslulciuc)

api/src/main/java/marquez/db/OpenLineageDao.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ enum SpecEventType {
9595
+ "job_namespace, "
9696
+ "event, "
9797
+ "producer, "
98-
+ "spec_event_type) "
98+
+ "_event_type) "
9999
+ "VALUES (?, ?, ?, ?, ?, ?, ?, 'RUN_EVENT')")
100100
void createLineageEvent(
101101
String eventType,
@@ -111,7 +111,7 @@ void createLineageEvent(
111111
+ "event_time, "
112112
+ "event, "
113113
+ "producer, "
114-
+ "spec_event_type) "
114+
+ "_event_type) "
115115
+ "VALUES (?, ?, ?, 'DATASET_EVENT')")
116116
void createDatasetEvent(Instant eventTime, PGobject event, String producer);
117117

@@ -122,13 +122,13 @@ void createLineageEvent(
122122
+ "job_namespace, "
123123
+ "event, "
124124
+ "producer, "
125-
+ "spec_event_type) "
125+
+ "_event_type) "
126126
+ "VALUES (?, ?, ?, ?, ?, 'JOB_EVENT')")
127127
void createJobEvent(
128128
Instant eventTime, String jobName, String jobNamespace, PGobject event, String producer);
129129

130130
@SqlQuery(
131-
"SELECT event FROM lineage_events WHERE run_uuid = :runUuid AND spec_event_type='RUN_EVENT'")
131+
"SELECT event FROM lineage_events WHERE run_uuid = :runUuid AND _event_type='RUN_EVENT'")
132132
List<LineageEvent> findLineageEventsByRunUuid(UUID runUuid);
133133

134134
@SqlQuery(
@@ -137,7 +137,7 @@ void createJobEvent(
137137
FROM lineage_events le
138138
WHERE (le.event_time < :before
139139
AND le.event_time >= :after)
140-
AND le.spec_event_type='RUN_EVENT'
140+
AND le._event_type='RUN_EVENT'
141141
ORDER BY le.event_time DESC
142142
LIMIT :limit OFFSET :offset""")
143143
List<LineageEvent> getAllLineageEventsDesc(
@@ -149,7 +149,7 @@ List<LineageEvent> getAllLineageEventsDesc(
149149
FROM lineage_events le
150150
WHERE (le.event_time < :before
151151
AND le.event_time >= :after)
152-
AND le.spec_event_type='RUN_EVENT'
152+
AND le._event_type='RUN_EVENT'
153153
ORDER BY le.event_time ASC
154154
LIMIT :limit OFFSET :offset""")
155155
List<LineageEvent> getAllLineageEventsAsc(

api/src/main/java/marquez/db/migrations/V66_2_JobFacetsBackfillJobVersion.java renamed to api/src/main/java/marquez/db/migrations/V66_3_JobFacetsBackfillJobVersion.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.jdbi.v3.core.Jdbi;
1313

1414
@Slf4j
15-
public class V66_2_JobFacetsBackfillJobVersion implements JavaMigration {
15+
public class V66_3_JobFacetsBackfillJobVersion implements JavaMigration {
1616

1717
public static final String UPDATE_QUERY =
1818
"""
@@ -24,7 +24,7 @@ public class V66_2_JobFacetsBackfillJobVersion implements JavaMigration {
2424

2525
@Override
2626
public MigrationVersion getVersion() {
27-
return MigrationVersion.fromVersion("66.2");
27+
return MigrationVersion.fromVersion("66.3");
2828
}
2929

3030
@Override

api/src/main/resources/marquez/db/migration/V65__dataset_facets_lineage_event_type_nullable.sql renamed to api/src/main/resources/marquez/db/migration/V65__alter_dataset_facets_to_change_lineage_event_type_as_nullable.sql

File renamed without changes.

api/src/main/resources/marquez/db/migration/V66.1__job_facets_changes.sql renamed to api/src/main/resources/marquez/db/migration/V66.1__alter_job_facets.sql

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,4 @@ ALTER TABLE job_facets ALTER COLUMN lineage_event_type DROP NOT NULL;
22
ALTER TABLE job_facets DROP CONSTRAINT job_facets_run_uuid_fkey;
33
ALTER TABLE job_facets ADD COLUMN job_version_uuid uuid REFERENCES job_versions (uuid);
44

5-
CREATE INDEX job_facets_job_version_uuid ON job_facets (job_version_uuid);
6-
7-
ALTER TABLE lineage_events ADD COLUMN spec_event_type VARCHAR(64);
8-
UPDATE lineage_events SET spec_event_type = 'RunEvent';
5+
CREATE INDEX job_facets_job_version_uuid ON job_facets (job_version_uuid);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
CREATE TYPE EVENT_TYPE AS ENUM ('RUN_EVENT', 'DATASET_EVENT', 'JOB_EVENT');
2+
3+
ALTER TABLE lineage_events ADD COLUMN _event_type EVENT_TYPE;
4+
ALTER TABLE lineage_events ALTER COLUMN _event_type SET DEFAULT 'RUN_EVENT';

api/src/test/java/marquez/db/migrations/V66_2_JobFacetsBackfillJobVersionTest.java renamed to api/src/test/java/marquez/db/migrations/V66_3_JobFacetsBackfillJobVersionTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,19 @@
3434

3535
/** Test to validate if a job_version_column is filled properly within job_facets table */
3636
@ExtendWith(MarquezJdbiExternalPostgresExtension.class)
37-
@FlywayTarget("66.1")
37+
@FlywayTarget("66.3")
3838
@FlywaySkipRepeatable()
3939
@Slf4j
40-
public class V66_2_JobFacetsBackfillJobVersionTest {
40+
public class V66_3_JobFacetsBackfillJobVersionTest {
4141

42-
private static V66_2_JobFacetsBackfillJobVersion migration =
43-
new V66_2_JobFacetsBackfillJobVersion();
42+
private static V66_3_JobFacetsBackfillJobVersion migration =
43+
new V66_3_JobFacetsBackfillJobVersion();
4444
static Jdbi jdbi;
4545
private static OpenLineageDao openLineageDao;
4646

4747
@BeforeAll
4848
public static void setUpOnce(Jdbi jdbi) {
49-
V66_2_JobFacetsBackfillJobVersionTest.jdbi = jdbi;
49+
V66_3_JobFacetsBackfillJobVersionTest.jdbi = jdbi;
5050
openLineageDao = jdbi.onDemand(OpenLineageDao.class);
5151
}
5252

@@ -91,7 +91,7 @@ public Connection getConnection() {
9191
}
9292
};
9393
// apply migrations in order
94-
new V66_2_JobFacetsBackfillJobVersion().migrate(context);
94+
new V66_3_JobFacetsBackfillJobVersion().migrate(context);
9595
} catch (Exception e) {
9696
throw new AssertionError("Unable to execute migration", e);
9797
}

0 commit comments

Comments
 (0)