diff --git a/airflow/providers/amazon/aws/hooks/glue.py b/airflow/providers/amazon/aws/hooks/glue.py index be85f2fec4cf3..2fc342675db44 100644 --- a/airflow/providers/amazon/aws/hooks/glue.py +++ b/airflow/providers/amazon/aws/hooks/glue.py @@ -185,7 +185,7 @@ def get_or_create_glue_job(self) -> str: "Name": "glueetl", "ScriptLocation": self.script_location, } - command = self.create_job_kwargs.get("Command", default_command) + command = self.create_job_kwargs.pop("Command", default_command) if "WorkerType" in self.create_job_kwargs and "NumberOfWorkers" in self.create_job_kwargs: create_job_response = glue_client.create_job( diff --git a/tests/providers/amazon/aws/hooks/test_glue.py b/tests/providers/amazon/aws/hooks/test_glue.py index 4e3afd0453834..e8f55c5b81caa 100644 --- a/tests/providers/amazon/aws/hooks/test_glue.py +++ b/tests/providers/amazon/aws/hooks/test_glue.py @@ -102,6 +102,7 @@ def test_get_or_create_glue_job_create_new_job(self, mock_get_iam_execution_role script_location="s3://bucket", s3_bucket="bucket", region_name=self.some_aws_region, + create_job_kwargs={"Command": {}}, ) result = hook.get_or_create_glue_job()