Skip to content

Commit

Permalink
Rename starting_from to sinc
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-nambiar committed Oct 23, 2023
1 parent 0bd7ae8 commit 7073178
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions fennel/sources/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
def source(
conn: DataConnector,
every: Optional[Duration] = None,
starting_from: Optional[datetime] = None,
since: Optional[datetime] = None,
lateness: Optional[Duration] = None,
cdc: Optional[str] = None,
) -> Callable[[T], Any]:
Expand All @@ -40,14 +40,14 @@ def source(
f"{', '.join(conn.required_fields())}."
)

if starting_from is not None and not isinstance(starting_from, datetime):
if since is not None and not isinstance(since, datetime):
raise TypeError("starting_from must be of type datetime")

def decorator(dataset_cls: T):
conn.every = every if every is not None else DEFAULT_EVERY
conn.lateness = lateness if lateness is not None else DEFAULT_LATENESS
conn.cdc = cdc if cdc is not None else DEFAULT_CDC
conn.starting_from = starting_from
conn.starting_from = since
if hasattr(dataset_cls, SOURCE_FIELD):
raise Exception(
"Multiple sources are not supported in dataset `%s`."
Expand Down
4 changes: 2 additions & 2 deletions fennel/sources/test_invalid_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def test_invalid_starting_from():
bigquery.table("users_bq", cursor="added_on"),
every="1h",
lateness="2h",
starting_from=datetime.now(),
since=datetime.now(),
)
@dataset
class UserInfoDatasetBigQuery:
Expand All @@ -325,7 +325,7 @@ class UserInfoDatasetBigQuery:
@source(
s3.bucket(bucket_name="bucket", prefix="prefix"),
every="1h",
starting_from="2020-01-01T00:00:00Z",
since="2020-01-01T00:00:00Z",
)
@meta(owner="[email protected]")
@dataset
Expand Down
4 changes: 1 addition & 3 deletions fennel/sources/test_sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ def test_multiple_sources():
),
every="1h",
lateness="2d",
starting_from=datetime.strptime(
"2021-08-10T00:00:00Z", "%Y-%m-%dT%H:%M:%SZ"
),
since=datetime.strptime("2021-08-10T00:00:00Z", "%Y-%m-%dT%H:%M:%SZ"),
)
@dataset
class UserInfoDatasetS3:
Expand Down

0 comments on commit 7073178

Please sign in to comment.