Skip to content

Commit

Permalink
Remove usage of current_job_context_uuid column (#2622)
Browse files Browse the repository at this point in the history
* Remove usage of `current_job_context_uuid` col

Signed-off-by: wslulciuc <[email protected]>

* Remove `job_context_uuid` col from `RunDao`

Signed-off-by: wslulciuc <[email protected]>

---------

Signed-off-by: wslulciuc <[email protected]>
  • Loading branch information
wslulciuc authored Sep 26, 2023
1 parent 2c573dc commit 301487e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 18 deletions.
4 changes: 0 additions & 4 deletions api/src/main/java/marquez/db/JobDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ INSERT INTO jobs_view AS j (
namespace_name,
name,
description,
current_job_context_uuid,
current_location,
current_inputs,
symlink_target_uuid,
Expand All @@ -297,7 +296,6 @@ INSERT INTO jobs_view AS j (
:namespaceName,
:name,
:description,
null,
:location,
:inputs,
:symlinkTargetId,
Expand Down Expand Up @@ -332,7 +330,6 @@ INSERT INTO jobs_view AS j (
namespace_name,
name,
description,
current_job_context_uuid,
current_location,
current_inputs,
symlink_target_uuid
Expand All @@ -346,7 +343,6 @@ INSERT INTO jobs_view AS j (
:namespaceName,
:name,
:description,
null,
:location,
:inputs,
:symlinkTargetId
Expand Down
12 changes: 4 additions & 8 deletions api/src/main/java/marquez/db/RunDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ LEFT OUTER JOIN (
+ "transitioned_at, "
+ "namespace_name, "
+ "job_name, "
+ "location, "
+ "job_context_uuid "
+ "location "
+ ") VALUES ( "
+ ":runUuid, "
+ ":parentRunUuid, "
Expand All @@ -224,8 +223,7 @@ LEFT OUTER JOIN (
+ ":runStateTime, "
+ ":namespaceName, "
+ ":jobName, "
+ ":location, "
+ "null "
+ ":location "
+ ") ON CONFLICT(uuid) DO "
+ "UPDATE SET "
+ "external_id = EXCLUDED.external_id, "
Expand Down Expand Up @@ -266,8 +264,7 @@ RunRow upsert(
+ "nominal_end_time, "
+ "namespace_name, "
+ "job_name, "
+ "location, "
+ "job_context_uuid "
+ "location "
+ ") VALUES ( "
+ ":runUuid, "
+ ":parentRunUuid, "
Expand All @@ -281,8 +278,7 @@ RunRow upsert(
+ ":nominalEndTime, "
+ ":namespaceName, "
+ ":jobName, "
+ ":location, "
+ "null"
+ ":location "
+ ") ON CONFLICT(uuid) DO "
+ "UPDATE SET "
+ "external_id = EXCLUDED.external_id, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ LEFT JOIN LATERAL (
public static final String INSERT_NEW_JOB_WITH_PARENT =
"""
INSERT INTO jobs(uuid, type, created_at, updated_at, namespace_uuid, name, description,
current_version_uuid, namespace_name, current_job_context_uuid, current_location, current_inputs,
current_version_uuid, namespace_name, current_location, current_inputs,
parent_job_uuid)
SELECT :uuid, type, created_at, updated_at, namespace_uuid, name, description, current_version_uuid,
namespace_name, current_job_context_uuid, current_location, current_inputs, :parent_job_uuid
namespace_name, current_location, current_inputs, :parent_job_uuid
FROM jobs
WHERE uuid=:job_uuid
ON CONFLICT (name, namespace_name, parent_job_uuid) DO NOTHING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ BEGIN
NEW.description,
NEW.current_version_uuid,
NEW.namespace_name,
NEW.current_job_context_uuid,
NULL,
NEW.current_location,
NEW.current_inputs,
NEW.symlink_target_uuid,
Expand All @@ -67,7 +67,6 @@ BEGIN
END,
type = EXCLUDED.type,
description = EXCLUDED.description,
current_job_context_uuid = EXCLUDED.current_job_context_uuid,
current_location = EXCLUDED.current_location,
current_inputs = EXCLUDED.current_inputs,
-- update the symlink target if null. otherwise, keep the old value
Expand Down
4 changes: 2 additions & 2 deletions api/src/test/java/marquez/db/BackfillTestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ public static UUID writeJob(Jdbi jdbi, String jobName, Instant now, NamespaceRow
h -> {
return h.createQuery(
"""
INSERT INTO jobs (uuid, type, created_at, updated_at, namespace_uuid, name, namespace_name, current_job_context_uuid, current_inputs)
VALUES (:uuid, :type, :now, :now, :namespaceUuid, :name, :namespaceName, null, :currentInputs)
INSERT INTO jobs (uuid, type, created_at, updated_at, namespace_uuid, name, namespace_name, current_inputs)
VALUES (:uuid, :type, :now, :now, :namespaceUuid, :name, :namespaceName, :currentInputs)
RETURNING uuid
""")
.bind("uuid", UUID.randomUUID())
Expand Down

0 comments on commit 301487e

Please sign in to comment.