Skip to content

Commit

Permalink
Fixed minor linting issues discovered after fixing scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhazuka committed Sep 26, 2023
1 parent 13a0e6a commit 67518cf
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
12 changes: 6 additions & 6 deletions tasks/db_deploy/install/orca_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text:
Returns:
SQL for creating orca_dbo role.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -81,7 +81,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text:
GRANT orca_dbo TO "{admin_username}";
END
$$
""" # nosec
"""
)


Expand All @@ -93,7 +93,7 @@ def app_role_sql(db_name: str) -> text:
Returns:
SQL for creating orca_app role.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -114,7 +114,7 @@ def app_role_sql(db_name: str) -> text:
GRANT CONNECT ON DATABASE "{db_name}" TO orca_app;
END
$$;
""" # nosec
"""
)


Expand Down Expand Up @@ -177,7 +177,7 @@ def app_user_sql(user_name: str) -> text:
Returns:
SQL for creating PREFIX_orcauser user.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -202,7 +202,7 @@ def app_user_sql(user_name: str) -> text:
ALTER ROLE "{user_name}" SET search_path = orca, public;
END
$$;
""" # nosec
"""
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text:
Returns:
SQL for creating orca_dbo role.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -40,7 +40,7 @@ def dbo_role_sql(db_name: str, admin_username: str) -> text:
GRANT orca_dbo TO "{admin_username}";
END
$$
""" # nosec
"""
)


Expand All @@ -52,7 +52,7 @@ def app_role_sql(db_name: str) -> text:
Returns:
SQL for creating orca_app role.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -73,7 +73,7 @@ def app_role_sql(db_name: str) -> text:
GRANT CONNECT ON DATABASE "{db_name}" TO orca_app;
END
$$;
""" # nosec
"""
)


Expand Down Expand Up @@ -136,7 +136,7 @@ def app_user_sql(user_name: str) -> text:
Returns:
SQL for creating PREFIX_orcauser user.
"""
return text(
return text( # nosec
f"""
DO
$$
Expand All @@ -161,7 +161,7 @@ def app_user_sql(user_name: str) -> text:
ALTER ROLE "{user_name}" SET search_path = orca, public;
END
$$;
""" # nosec
"""
)


Expand Down
6 changes: 3 additions & 3 deletions tasks/get_current_archive_list/get_current_archive_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,8 +436,8 @@ def translate_s3_import_to_partitioned_data_sql() -> text: # pragma: no cover
"""
SQL for translating between the temporary table and Orca table.
"""
return text(
f"""
return text( # nosec # noqa
"""
INSERT INTO orca.reconcile_s3_object (
job_id,
orca_archive_location,
Expand All @@ -460,7 +460,7 @@ def translate_s3_import_to_partitioned_data_sql() -> text: # pragma: no cover
storage_class, delete_marker
FROM s3_import
WHERE is_latest = TRUE
""" # nosec # noqa
"""
)


Expand Down
12 changes: 6 additions & 6 deletions tasks/perform_orca_reconcile/perform_orca_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def generate_orphan_reports_sql() -> text: # pragma: no cover
"""
SQL for generating reports on files in S3, but not the Orca catalog.
"""
return text(
f"""
return text( # nosec # noqa
"""
WITH
orphan_reports AS
(
Expand Down Expand Up @@ -247,16 +247,16 @@ def generate_orphan_reports_sql() -> text: # pragma: no cover
size_in_bytes,
storage_class
FROM
orphan_reports""" # nosec # noqa
orphan_reports"""
)


def generate_mismatch_reports_sql() -> text: # pragma: no cover
"""
SQL for retrieving mismatches between entries in S3 and the Orca catalog.
"""
return text(
f"""
return text( # nosec # noqa
"""
INSERT INTO orca.reconcile_catalog_mismatch_report
(
job_id,
Expand Down Expand Up @@ -333,7 +333,7 @@ def generate_mismatch_reports_sql() -> text: # pragma: no cover
files.etag != reconcile_s3_object.etag OR
files.size_in_bytes != reconcile_s3_object.size_in_bytes OR
storage_class.value != reconcile_s3_object.storage_class
)""" # nosec # noqa
)"""
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def get_metadata_sql(key_path: str) -> text:
Returns:
(sqlalchemy.text): SQL statement
"""
return text(
return text( # nosec
f"""
SELECT
job_id, granule_id, filename, restore_destination, multipart_chunksize_mb
Expand All @@ -271,7 +271,7 @@ def get_metadata_sql(key_path: str) -> text:
key_path = '{key_path}'
AND
status_id = {shared_recovery.OrcaStatus.PENDING.value}
""" # nosec
"""
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ def test_query_db_exceptions_bubble_up(
def test_get_metadata_sql_happy_path(self):
key_path = uuid.uuid4().__str__()
result = post_copy_request_to_queue.get_metadata_sql(key_path)
self.assertEqual(
self.assertEqual( # nosec
f"""
SELECT
job_id, granule_id, filename, restore_destination, multipart_chunksize_mb
Expand All @@ -779,6 +779,6 @@ def test_get_metadata_sql_happy_path(self):
key_path = '{key_path}'
AND
status_id = {shared_recovery.OrcaStatus.PENDING.value}
""", # nosec
""",
result.text,
)

0 comments on commit 67518cf

Please sign in to comment.