Skip to content

Commit

Permalink
low-code: Delete now_local macro (#25404)
Browse files Browse the repository at this point in the history
* Delete now_local macro

* Remove from reference docs

* remove example
  • Loading branch information
girarda committed Apr 26, 2023
1 parent 3b4fa65 commit 250c3b1
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,6 @@ definitions:
examples:
- "2021-01-1T00:00:00Z"
- "{{ now_utc() }}"
- "{{ now_local() }}"
start_datetime:
title: Start Datetime
description: The datetime that determines the earliest record that should be synced.
Expand Down Expand Up @@ -1974,12 +1973,6 @@ interpolation:
- title: stream_state
description: The current state of the stream.
macros:
- title: Now (Local)
description: Returns the current date and time using the local to the machine running the sync. We recommend using now_utc() instead of now_local() because it is more predictable.
arguments: {}
return_type: Datetime
examples:
- "{{ now_local() }}"
- title: Now (UTC)
description: Returns the current date and time in the UTC timezone.
arguments: {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
"""


def now_local() -> datetime.datetime:
"""
Current local date and time.
Usage:
`"{{ now_local() }}"
"""
return datetime.datetime.now()


def now_utc():
"""
Current local date and time in UTC timezone
Expand Down Expand Up @@ -127,5 +117,5 @@ def format_datetime(dt: Union[str, datetime.datetime], format: str) -> str:
return _str_to_datetime(dt).strftime(format)


_macros_list = [now_local, now_utc, today_utc, timestamp, max, day_delta, duration, format_datetime]
_macros_list = [now_utc, today_utc, timestamp, max, day_delta, duration, format_datetime]
macros = {f.__name__: f for f in _macros_list}
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ class DatetimeBasedCursor(BaseModel):
end_datetime: Union[str, MinMaxDatetime] = Field(
...,
description="The datetime that determines the last record that should be synced.",
examples=["2021-01-1T00:00:00Z", "{{ now_utc() }}", "{{ now_local() }}"],
examples=["2021-01-1T00:00:00Z", "{{ now_utc() }}"],
title="End Datetime",
)
start_datetime: Union[str, MinMaxDatetime] = Field(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
@pytest.mark.parametrize(
"test_name, fn_name, found_in_macros",
[
("test_now_local", "now_local", True),
("test_now_utc", "now_utc", True),
("test_today_utc", "today_utc", True),
("test_max", "max", True),
Expand Down

0 comments on commit 250c3b1

Please sign in to comment.