Skip to content

Commit 394a7e2

Browse files
fix: Set EtlTask.etl_date attribute to datetime type rather than module (#229)
## Description Currently, the `EtlTask` model has a private attribute (`etl_date`) defined as the `datetime` module, rather than the `datetime.datetime` type. This produces a warning such as the following: ``` UserWarning: <module 'datetime' from '/usr/lib/python3.11/datetime.py'> is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with `pydantic.SkipValidation`. ``` This change redefines the attribute as the `datetime.datetime` type. ## Related Issue Closes #228. ## Motivation and Context See description above. ## How Has This Been Tested? Manually. Imported the `EtlTask` and confirmed the warning is no longer produced. ## Screenshots (if appropriate): N/A ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Checklist: - [x] My code follows the code style of this project. - [ ] My change requires a change to the documentation. - [ ] I have updated the documentation accordingly. - [x] I have read the **CONTRIBUTING** document. - [ ] I have added tests to cover my changes. - [x] All new and existing tests passed.
1 parent cca5194 commit 394a7e2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/koheesio/spark/etl_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class EtlTask(Step):
8585
target: InstanceOf[Writer] = Field(default=..., description="Target to write to [load]")
8686

8787
# private attrs
88-
etl_date: datetime = Field(
88+
etl_date: datetime.datetime = Field(
8989
default_factory=utc_now,
9090
description="Date time when this object was created as iso format. Example: '2023-01-24T09:39:23.632374'",
9191
)

0 commit comments

Comments
 (0)